Synonyms

If multiple words have an equivalent meaning in your dataset, you can create a list of synonyms. This will make your search results more relevant.

In general, a search on a word will return the same results as a search on any of its synonyms.
There is one exception to this rule, detailed below.

Normalization

All synonyms are lowercased and de-unicoded during the indexing process.

Example

Consider a situation where “Résumé” and “CV” are set as synonyms.

  1. {
  2. "Résumé": [
  3. "CV"
  4. ],
  5. "CV": [
  6. "Résumé"
  7. ]
  8. }

A search for “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.

One-way association

Use this when you want one word to be synonymous with another, but not the other way around.

  1. phone => iphone

A search for 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.

Example

To create a one-way synonym list, this is the JSON syntax that should be added to the settings.

  1. {
  2. "phone": [
  3. "iphone"
  4. ]
  5. }

Mutual association

By associating one or more synonyms with each other, they will be considered the same in both directions.

  1. shoe <=> boot <=> slipper <=> sneakers

When a search is done with one of these words, all synonyms will be considered as the same word and will appear in the search results.

Example

To create a mutual association between four words, this is the JSON syntax that should be added to the settings.

  1. {
  2. "shoe": [
  3. "boot",
  4. "slipper",
  5. "sneakers"
  6. ],
  7. "boot": [
  8. "shoe",
  9. "slipper",
  10. "sneakers"
  11. ],
  12. "slipper": [
  13. "shoe",
  14. "boot",
  15. "sneakers"
  16. ],
  17. "sneakers": [
  18. "shoe",
  19. "boot",
  20. "slipper"
  21. ]
  22. }

Multi-word phrases

Take note that multi-word phrases are treated differently than associations between individual words.

When a multi-word phrase is considered the synonym of another word or phrase, the exact search query will always take precedence over its synonym(s).

TIP

Multi-word synonyms are limited to a maximum of three words.
For example, although you could make “League of Legends” and “LOL” into synonyms, you could not do the same for “The Lord of the Rings” and “LOTR”.

Example

Suppose you set “San Francisco” and “SF” as synonyms with a mutual association

  1. {
  2. "san francisco": [
  3. "sf"
  4. ],
  5. "sf": [
  6. "san francisco"
  7. ]
  8. }

If you input “SF” as a search query, then results containing “San Francisco” will also be returned. However, they will be considered less relevant than those containing “SF”. The reverse is also true.