Files
medusa-store/.changeset/strange-mails-pump.md
Oliver Windall Juhl 7e17e0ddc2 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>
2023-03-16 16:15:29 +01:00

66 lines
1.6 KiB
Markdown

---
"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.