Files
medusa-store/packages/medusa-plugin-meilisearch
Shahed Nasser 95232e7ac9 chore: updated READMEs of plugins (#3546)
* chore: updated READMEs of plugins

* added notice to plugins
2023-03-23 09:43:17 +02:00
..
2023-02-14 17:30:40 +01:00
2023-02-14 17:30:40 +01:00

MeiliSearch

Provide powerful indexing and searching features in your commerce application with MeiliSearch.

MeiliSearch Plugin Documentation | Medusa Website | Medusa Repository

Features

  • Flexible configurations for specifying searchable and retrievable attributes.
  • Ready-integration with Medusa's Next.js starter storefront.
  • Utilize MeiliSearch's powerful search functionalities including typo-tolerance, synonyms, filtering, and more.

Prerequisites


How to Install

1. Run the following command in the directory of the Medusa backend:

npm install medusa-plugin-meilisearch

2. Set the following environment variables in .env:

MEILISEARCH_HOST=<YOUR_MEILISEARCH_HOST>
MEILISEARCH_API_KEY=<YOUR_MASTER_KEY>

3. In medusa-config.js add the following at the end of the plugins array:

const plugins = [
  // ...
  {
    resolve: `medusa-plugin-meilisearch`,
    options: {
      // config object passed when creating an instance
      // of the MeiliSearch client
      config: {
        host: process.env.MEILISEARCH_HOST,
        apiKey: process.env.MEILISEARCH_API_KEY,
      },
      settings: {
        // index name
        products: {
          // MeiliSearch's setting options 
          // to be set on a particular index
          searchableAttributes: [
            "title", 
            "description",
            "variant_sku",
          ],
          displayedAttributes: [
            "title", 
            "description", 
            "variant_sku", 
            "thumbnail", 
            "handle",
          ],
        },
      },
    },
  },
]

Test the Plugin

1. Run the following command in the directory of the Medusa backend to run the backend:

npm run start

2. Try searching products either using your storefront or using the Store APIs.


Additional Resources