FORGEBOX Enterprise 🚀 - Take your ColdFusion (CFML) Development to Modern Times! Learn More...

cbMeilisearch

v1.1.0 Modules

cbMeilisearch

An API wrapper for Meilisearch written in CFML for the ColdBox platform.

Getting Started

  1. Install via CommandBox - box install cbmeilisearch
  2. Start a Meilisearch instance
  3. Configure cbMeilisearch
    1. via environment variables
    2. via Coldbox.cfc's ModuleSettings
  4. Get the Client model: getInstance( "Client@cbmeilisearch" )
  5. Make API calls: msClient.createIndex( "movies" )

Starting Meilisearch

From the Meilisearch Quickstart guide:

# Fetch the latest version of Meilisearch image from DockerHub
docker pull getmeili/meilisearch:v0.30

# Launch Meilisearch in development mode with a master key
docker run --detach --rm \
    -p 7700:7700 \
    -e MEILI_MASTER_KEY='mySecretKey'\
    getmeili/meilisearch:v0.30 \
    meilisearch \
    --env="development"

Configuration via Environment Variables

CBMeilisearch will try to pull Meilisearch connection settings from the environment variables by default. You can take advantage of this by creating a .env file in the root of your ColdBox app and using commandbox-dotenv or a similar tool to load the .env file into your application on startup.

# .env
MEILISEARCH_HOST=http://127.0.0.1
MEILISEARCH_PORT=7700
MEILISEARCH_MASTER_KEY=mySecretKey

Configuration via Coldbox's ModuleSettings

Use the following example configuration to get started configuring cbMeilisearch.

For obvious reasons, the host/port must point to a running Meilisearch instance, and the MEILISEARCH_MASTER_KEY must be the configured master key you set when starting Meilisearch.

// config/Coldbox.cfc
component{
  function configure(){
    moduleSettings = {
      "cbmeilisearch" : {
        "MEILISEARCH_HOST" : "localhost",
        "MEILISEARCH_PORT" : 7700,
        "MEILISEARCH_MASTER_KEY" : "mySecretKey"
      }
    }
  }
}

Usage

This library follows the Meilisearch API reference as closely as possible.

🤖 Meilisearch Version Compatibility

This package guarantees compatibility with Meilisearch versions:

Versions v0.27.x and below are NOT supported due to the breaking changes introduced in v0.28.0.

TODO / Help Needed

Looking to contribute? I'd love to see help in these areas:

License

Apache License, Version 2.0.

The ColdBox Websites, logo and content have a separate license and they are a separate entity.

The Good News

For all have sinned, and come short of the glory of God (Romans 3:23)

But God commendeth his love toward us, in that, while we were yet sinners, Christ died for us. (Romans 5:8)

That if thou shalt confess with thy mouth the Lord Jesus, and shalt believe in thine heart that God hath raised him from the dead, thou shalt be saved. (Romans 10:9)

Repository

Copyright 2022 (and on) - Ortus Solutions

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.


[1.1.0] => 2023-JANUARY

  • Added support for Meilisearch v0.30
  • Added support for Meilisearch v0.29
  • 📦 NEW: Add Swap Indexes endpoint support
  • 📦 NEW: Add Task deletion endpoint support
  • 📦 NEW: Add Task cancellation support

[1.0.1] => 2022-SEPTEMPER-28

  • 📦 NEW: Add support for empty API key
  • ‼ BREAKING: Rename handleResponse() to parseAndThrow()

[1.0.0] => 2022-SEPTEMPER-8

  • 📦 First iteration of this module
  • 📦 Added Documents API wrapper
  • 📦 Added Indexes API wrapper
  • 📦 Added Keys API wrapper
  • 📦 Added Search API wrapper
  • 📦 Added Stats API wrapper
  • 📦 Added Tasks API wrapper
  • 📦 Added Version API wrapper

$ box install cbmeilisearch

     
5.00 / 1
  • {{ getFullDate("2022-06-15T15:42:12Z") }}
  • {{ getFullDate("2023-02-09T21:54:49Z") }}
  • 1,654
  • 116