From 6c0ce5a2b1e0b3c257ba1593fbd9e9cc7f9b11eb Mon Sep 17 00:00:00 2001
From: Pavlo Tsyhanok <130260096+pavlotsyhanok@users.noreply.github.com>
Date: Mon, 23 Sep 2024 00:17:58 -0700
Subject: [PATCH] Update meilisearch.md (#7862)
Problem:
The existing documentation for the Meilisearch plugin contains example that, if copy-pasted exactly, will not work.
Solution:
I have updated the Meilisearch plugin configuration example to reflect the correct settings.
Benefits:
With this updated code snippet, users can simply copy and paste it into their local medusa-config.js file. It will work seamlessly with the standard configuration and is compatible with the latest version of Meilisearch.
Testing:
The updated configuration has been tested and confirmed to work in a live deployment environment on Digital Ocean(Server) and Vercel(Storefront)
---
.../content/plugins/search/meilisearch.md | 27 ++++++++++++-------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/www/apps/docs/content/plugins/search/meilisearch.md b/www/apps/docs/content/plugins/search/meilisearch.md
index 1fcc93a4b8e88..e80ad8387e613 100644
--- a/www/apps/docs/content/plugins/search/meilisearch.md
+++ b/www/apps/docs/content/plugins/search/meilisearch.md
@@ -127,25 +127,32 @@ const plugins = [
{
resolve: `medusa-plugin-meilisearch`,
options: {
- // other options...
+ config: {
+ host: process.env.MEILISEARCH_HOST,
+ apiKey: process.env.MEILISEARCH_API_KEY,
+ },
settings: {
products: {
indexSettings: {
- searchableAttributes: [
- "title",
+ searchableAttributes: ["title", "description", "variant_sku"],
+ displayedAttributes: [
+ "title",
"description",
"variant_sku",
- ],
- displayedAttributes: [
- "id",
- "title",
- "description",
- "variant_sku",
- "thumbnail",
+ "thumbnail",
"handle",
],
},
primaryKey: "id",
+ transformer: (product) => ({
+ id: product.id,
+ title: product.title,
+ description: product.description,
+ variant_sku: product.variant_sku,
+ thumbnail: product.thumbnail,
+ handle: product.handle,
+ // include other attributes as needed
+ }),
},
},
},