Closed loiclec closed 1 year ago
Checked with @gmourier, since this PR has a product impact and we don't get any approval from the product team yet on this, don't merge it until @gmourier validates it 😇
Awaiting the approval of @gmourier ⌛
I'm late to the party to signal the product team stamp of approval🏃♂️ Thanks for that enhancement @loiclec!
bors merge
Build succeeded:
Pull Request
Related issue
Fixes (when merged into meilisearch) https://github.com/meilisearch/meilisearch/issues/3125
What does this PR do?
We now map multi-word synonyms to phrases instead of loose words. Such that the request:
is interpreted as (when the synonym interpretation is chosen for both
btw
andnyc
):instead of:
This prevents queries containing multi-word synonyms to exceed to word length limit and degrade the search performance.
In terms of relevancy, there is a debate to have. I personally think this could be considered an improvement, since it would be strange for a user to search for:
and have a result such as:
However, for synonyms such as
NYC -> New York City
, then we will stop matching documents whereNew York
is separated fromCity
. This is however solvable by adding an additional mapping:NYC -> New York
.Performance
With the old behaviour, some long search requests making heavy uses of synonyms could take minutes to be executed. This is no longer the case, these search requests now take an average amount of time to be resolved.