-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomersinstant-meilisearch
Description
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):
Lines 212 to 217 in 8df981a
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
}
},
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomersinstant-meilisearch