Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(medusa-plugin-meilisearch): Update + improve Meilisearch plugin #3377

Merged
merged 20 commits into from
Mar 16, 2023

Conversation

olivermrbl
Copy link
Contributor

@olivermrbl olivermrbl commented Mar 4, 2023

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.

The transformer allows developers to specify how their documents are stored in Meilisearch. It is configurable for each index.


Solves Discussion #3277
Solves #3373
Solves #2959 (no tests with the extender, as that is out of scope)

@changeset-bot
Copy link

changeset-bot bot commented Mar 4, 2023

🦋 Changeset detected

Latest commit: 5982c08

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
medusa-plugin-meilisearch Major
@medusajs/medusa Patch
@medusajs/inventory Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Mar 4, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
medusa-docs ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 16, 2023 at 3:37PM (UTC)

@olivermrbl olivermrbl linked an issue Mar 4, 2023 that may be closed by this pull request
@olivermrbl olivermrbl closed this Mar 4, 2023
@srindom
Copy link
Collaborator

srindom commented Mar 9, 2023

@olivermrbl - why is this closed?

@olivermrbl
Copy link
Contributor Author

olivermrbl commented Mar 9, 2023

I am not entirely done with the PR. I can reopen it as draft, if that's better? :)

@olivermrbl olivermrbl reopened this Mar 9, 2023
@olivermrbl
Copy link
Contributor Author

olivermrbl commented Mar 9, 2023

@srindom Also, there are a couple of decisions to be made around the transformer strategy. I took a first stab at a solution, allowing developers to provide their own. Would love some feedback on it. And if you have any ideas for alternative approaches, please feel free to pitch in.

@olivermrbl olivermrbl changed the title feat(medusa-plugin-meilisearch): Freshen up Meilisearch plugin feat(medusa-plugin-meilisearch): Revamp Meilisearch plugin Mar 12, 2023
@olivermrbl olivermrbl changed the title feat(medusa-plugin-meilisearch): Revamp Meilisearch plugin feat(medusa-plugin-meilisearch): Update + improve Meilisearch plugin Mar 12, 2023
@olivermrbl
Copy link
Contributor Author

If we proceed with these changes, the Algolia plugin should be updated as well.

Copy link
Member

@adrien2p adrien2p left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for the scope of that PR 💪

@olivermrbl
Copy link
Contributor Author

@srindom Would like to hear what you think about this proposal. Note, I've intentionally kept the scope small to solve the issues at hand.

Copy link
Collaborator

@srindom srindom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Only have a small question on the version bump

.changeset/strange-mails-pump.md Outdated Show resolved Hide resolved
@olivermrbl olivermrbl merged commit 7e17e0d into develop Mar 16, 2023
@olivermrbl olivermrbl deleted the feat/meilisearch-revamp branch March 16, 2023 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Meilisearch doesn't show mid_code & hs_code.
3 participants