How Synonyms Work | Yext Hitchhikers Platform
What You’ll Learn
In this section, you will learn:
- How the Search algorithm deals with synonyms
Overview
So how do synonyms actually work within the context of the Search algorithm?
One Way Synonyms
Let’s walk through how a one-way synonym would be treated.
For a single query, we take each word, and every combination of sequential words, and check if a synonym exists for that phrase. Using the synonyms that are defined in the backend configuration, the algorithm produces “expanded” versions of the query - e.g., replacing the parts of the query with matching synonyms.
Example:
- Original Search Term: “Career information”
- Synonyms: “career” → “Job”,
Expanded Search Terms:
- “Career information”
- “Job information”
Find Potential Matches using natural language processing: Search then conducts a search using the expanded versions of the query. In looking for matches, it searches across textSearch and NLP searchable fields.
- Taking the above example, Search searches all verticals for both “career information” and “job information” looking for matches in any pre-defined searchable fields.
Return the Best Results: The Search Algorithm determines the best results and returns them. This might be a match for the original query (“career information”), or for any of the expanded search terms (“job information”).
Do other full text search: Return other entities using full text search from the original query (just as if the synonyms weren’t there).
Synonym Sets
Now that you understand how one-way synonyms work - you also understand how synonym sets work. The only difference between the two is that sets expand in both directions. We are essentially just creating many one-way synonyms for all permutations of the set!
Normalization Synonyms
Normalization synonyms are the exact inverse of a one-way synonym, where a set of many terms is mapped to one term. These are particularly useful when multiple search terms can be used to reference the same thing.
Example:
- Original Search Term: “doctor near me”
- Synonyms: “physician”, “nurse”, “md” → “doctor”
Expanded search terms:
- “Physician near me”
- “Nurse near me”
- “MD near me”