🎉 Try the public beta of the new docs site at algolia.com/doc-beta! 🎉
Guides / Managing results / Optimize search results / Adding synonyms

For regular synonyms, each word in a list of synonyms can be replaced by the others.

For example, in a list ["pants", "trousers"], a search for “trousers” returns records with “pants”, and a search for “pants” returns “trousers”.

1
2
3
4
5
6
7
8
{
   "objectID": "a-list-of-2-synonyms",
   "type": "synonym",
   "synonyms": [
      "pants",
      "trousers"
   ]
}

You can also create synonym groups. For example, you can add “slacks” to the “pants, trousers” group: a search for “slacks” returns “pants” and “trousers”, and a search for “pants” returns “trousers” and “slacks”.

1
2
3
4
5
6
7
8
9
{
   "objectID": "a-list-of-3-or-more-synonyms",
   "type": "synonym",
   "synonyms": [
      "pants",
      "trousers",
      "slacks"
   ]
}
Did you find this page helpful?