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

Add per index meilisearchParams (for multi search) #1361

Open
8byr0 opened this issue Jan 16, 2025 · 0 comments · May be fixed by #1364
Open

Add per index meilisearchParams (for multi search) #1361

8byr0 opened this issue Jan 16, 2025 · 0 comments · May be fixed by #1364
Labels
enhancement New feature or request good first issue Good for newcomers instant-meilisearch

Comments

@8byr0
Copy link

8byr0 commented Jan 16, 2025

Description
Right now creating a client with custom params is done like this :

const client = instantMeiliSearch(
      "host",
      "key",
      {
        meiliSearchParams: {
          matchingStrategy: MatchingStrategies.ALL,
        },
      },
    ).searchClient;

Let's say I am on an ecommerce website searching in products and categories at the same time but want a different matching strategy. For example searching "i7 computer", I'd like suggested categories to include "Computers" but products to only include the ones with "i7" and "Computer" in its title or description.

To achieve such behavior I could then do :

const client = instantMeiliSearch(
      "host",
      "key",
      {
        meiliSearchParams: {
          products: { matchingStrategy: MatchingStrategies.ALL },
          categories: { matchingStrategy: MatchingStrategies.LAST },
        },
      },
    ).searchClient;

I can make a PR if you agree. We need to update the types and handle it here (and for every param):

addMatchingStrategy() {
const value = overrideParams?.matchingStrategy
if (value !== undefined) {
meiliSearchParams.matchingStrategy = value
}
},

like so :

    addMatchingStrategy() {
      const value = overrideParams?.matchingStrategy || overrideParams[indexUid].matchingStrategy;
      if (value !== undefined) {
        meiliSearchParams.matchingStrategy = value
      }
    },
@8byr0 8byr0 changed the title Add per index meilisearch config (for multi search) Add per index meilisearchParams (for multi search) Jan 16, 2025
@Strift Strift added enhancement New feature or request good first issue Good for newcomers instant-meilisearch labels Jan 17, 2025
@8byr0 8byr0 linked a pull request Jan 17, 2025 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers instant-meilisearch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants