feat(medusa-plugin-meilisearch): Update + improve Meilisearch plugin (#3377)
* feat(medusa-plugin-meilisearch): Upgrade meilisearch deps + migrate plugin to TS * fix version * Remove transaction base service from search service * Create .changeset/strange-mails-pump.md * Backward compatibility * Address PR feedback * Fix folder structure * Update readme * Move types * fix deps * Change version in changeset --------- Co-authored-by: adrien2p <adrien.deperetti@gmail.com>
This commit is contained in:
co-authored by
adrien2p
parent
4213326fe8
commit
7e17e0ddc2
@@ -0,0 +1,65 @@
|
||||
---
|
||||
"medusa-plugin-meilisearch": major
|
||||
"@medusajs/medusa": patch
|
||||
---
|
||||
|
||||
feat(medusa-plugin-meilisearch): Update + improve Meilisearch plugin
|
||||
|
||||
**What**
|
||||
- Bumps `meilisearch` dep to latest major
|
||||
- Migrates plugin to TypeScript
|
||||
- Changes the way indexes are configured in `medusa-config.js`:
|
||||
|
||||
**Before**
|
||||
```
|
||||
{
|
||||
resolve: `medusa-plugin-meilisearch`,
|
||||
options: {
|
||||
config: { host: "...", apiKey: "..." },
|
||||
settings: {
|
||||
products: {
|
||||
searchableAttributes: ["title"],
|
||||
displayedAttributes: ["title"],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
```
|
||||
|
||||
**After**
|
||||
```
|
||||
{
|
||||
resolve: `medusa-plugin-meilisearch`,
|
||||
options: {
|
||||
config: { host: "...", apiKey: "..." },
|
||||
settings: {
|
||||
products: {
|
||||
**indexSettings**: {
|
||||
searchableAttributes: ["title"],
|
||||
displayedAttributes: ["title"],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
```
|
||||
|
||||
This is done to allow for additional configuration of indexes, that are not necessarily passed on query-time.
|
||||
|
||||
We introduce two new settings:
|
||||
```
|
||||
settings: {
|
||||
products: {
|
||||
indexSettings: {
|
||||
searchableAttributes: ["title"],
|
||||
displayedAttributes: ["title"],,
|
||||
},
|
||||
primaryKey: "id"
|
||||
transformer: (document) => ({ id: "yo" })
|
||||
},
|
||||
},
|
||||
```
|
||||
|
||||
Meilisearch changed their primary key inference in the major release. Now we must be explicit when multiple properties end with `id`. Read more in their [docs](https://docs.meilisearch.com/learn/core_concepts/primary_key.html#primary-field).
|
||||
|
||||
The transformer allows developers to specify how their documents are stored in Meilisearch. It is configurable for each index.
|
||||
Reference in New Issue
Block a user