Add matching strategy option to search options
fatm-dev opened this issue · comments
Description
In meilisearch documentation we have matching strategy option. I couldn't find any usage of it in the vendor code or any other examples.
Basic example
I have a search which needs to find exact characters and i can't make it phrase search cause it won't show any of already returning hits. I can't put a limit as well cause I have different lengthed results. For example I type '1R220' it's shows approximetily 1000 hits just because it searchs for '1'.
Maybe there is another workaround?
Hi @FatimaMazhit you can use the matchingStrategy by doing this:
$client->index('movies')->search('big fat liar', [ 'matchingStrategy' => 'last' ]);
or:
$client->index('movies')->search('big fat liar', [ 'matchingStrategy' => 'all' ]);
You can read more about it here https://docs.meilisearch.com/reference/api/search.html#matching-strategy
Is this what you're looking for?
Hi @FatimaMazhit you can use the matchingStrategy by doing this:
$client->index('movies')->search('big fat liar', [ 'matchingStrategy' => 'last' ]);
or:$client->index('movies')->search('big fat liar', [ 'matchingStrategy' => 'all' ]);
You can read more about it here https://docs.meilisearch.com/reference/api/search.html#matching-strategy
Is this what you're looking for?
Hello. I'm using laravel So i used
IndexableModel::search($text, function ($searchEngine, string $query, array $options) { $options['matchingStrategy'] = 'all'; return $searchEngine->search($query, $options); })->get();
But it get me to the error that options doesn't have that key.
And there comes mighty solution: composer update (i was sure that it was in latest versions). Sorry for taking your time. Thanks )