MeiliSearch
Open-source search engine for your storefront
Meilisearch plugin for Medusa V2
Installation
Run the following command to install the plugin with npm:
1npm install --save @rokmohar/medusa-plugin-meilisearch
Or with yarn:
1yarn add @rokmohar/medusa-plugin-meilisearch
Upgrade to v1.0
This step is required only if you are upgrading from previous version to v1.0.
- The plugin now supports new MedusaJS plugin system.
- Subscribers are included in the plugin.
- You don't need custom subscribers anymore, you can remove them.
⚠️ MedusaJS v2.4.0 or newer
This plugin is only for MedusaJS v2.4.0 or newer.
If you are using MedusaJS v2.3.1 or older, please use the older version of this plugin.
Configuration
Add the plugin to your Copy to clipboardmedusa-config.ts
file:
1234567891011121314151617181920import { loadEnv, defineConfig } from '@medusajs/framework/utils'loadEnv(process.env.NODE_ENV || 'development', process.cwd())module.exports = defineConfig({// ... other configplugins: [// ... other plugins{resolve: '@rokmohar/medusa-plugin-meilisearch',options: {config: {host: process.env.MEILISEARCH_HOST ?? '',apiKey: process.env.MEILISEARCH_API_KEY ?? '',},settings: {// The key is used as the index name in Meilisearchproducts: {// Required: Index typetype: 'products',
ENV variables
Add the environment variables to your Copy to clipboard.env
and Copy to clipboard.env.template
file:
123# ... others varsMEILISEARCH_HOST=MEILISEARCH_API_KEY=
If you want to use with the Copy to clipboarddocker-compose
from this README, use the following values:
123# ... others varsMEILISEARCH_HOST=http://127.0.0.1:7700MEILISEARCH_API_KEY=ms
docker-compose
You can add the following configuration for Meilisearch to your Copy to clipboarddocker-compose.yml
:
12345678910111213141516services:# ... other servicesmeilisearch:image: getmeili/meilisearch:latestports:- '7700:7700'volumes:- ~/data.ms:/data.msenvironment:- MEILI_MASTER_KEY=mshealthcheck:test: ['CMD', 'curl', '-f', 'http://localhost:7700']interval: 10stimeout: 5sretries: 5
Add search to Medusa NextJS starter
You can find instructions on how to add search to a Medusa NextJS starter inside the nextjs folder.