Use Meilisearch synonyms to indicate sets of query terms which should be considered equivalent during search.
movies
dataset should return 547 results for great
and 66 for fantastic
. Let’s set them as synonyms:
great
returns 595 results and fantastic
returns 423 results. This is due to various factors like typos and splitting the query to find relevant documents. The search for great
will allow only one typo (for example, create
) and take into account all variations of great
(for instance, greatest
) along with fantastic
.
movies
dataset.Résumé
and CV
are set as synonyms.
cv
would return any documents containing cv
or CV
, in addition to any that contain Résumé
, resumé
, resume
, etc., unaffected by case or accent marks.
phone
will return documents containing iphone
as if they contained the word phone
.
However, if you search for iphone
, documents containing phone
will be ranked lower in the results due to the typo rule.
exactness
ranking rule favors exact words over synonyms when ranking search results.
Taking the following set of search results:
ghost
as a synonym of spirit
, queries searching for spirit
will return document 1
before document 0
.
San Francisco
and SF
as synonyms with a mutual association
SF
as a search query, Meilisearch will also return results containing the phrase San Francisco
. However, depending on the ranking rules, they might be considered less relevant than those containing SF
. The reverse is also true: if your query is San Francisco
, documents containing San Francisco
may rank higher than those containing SF
.
book
, Meilisearch will only return results containing the term itself and the first 50 synonyms.
If any synonyms for a term contain more than one word, the sum of all words across all synonyms for that term cannot exceed 100 words. Meilisearch silently ignores any synonyms beyond this limit. For example, if you configure 40 synonyms for computer
in your application, taken together these synonyms must contain fewer than 100 words.