# How Does a Thesaurus Work?
A thesaurus is a set of terms, their synonyms and possible misspellings, as well as inherent child elements. All entries form the synonym tree which represents the relation of the terms, and thus affects the search results.
# Synonym Tree Hierarchy
The synonym tree organizes its hierarchy with parent elements (terms) and child elements:
- parent element (term), synonym 1, synonym 2, misspelling 1, misspelling 2
- term's child element, synonym 1, misspelling 1
Synonyms and misspellings are on the same hierarchy level as the terms they are assigned to.
Child elements represent an "is-part-of" relationship with their parent element. You can thus express e.g. "electric bicycle" is also a "bike" by adding an "electric bicycle" entry as a child element to term "bike".
# Thesaurus Example
Synonym tree of thesaurus "Vehicles"
- "bicycle" and "cycle" are synonyms of "bike"
- "bycycle" is a misspelling of "bike"
- "electric bicycle" (and all its synonyms and misspellings) is a child element of "bike", "bicycle", "cycle", and "bycycle"
- "bike", "bicycle", "cycle", and "bycycle" are parent elements of "electric bicycle" (and all its synonyms and misspellings)
# How Does the Synonym Tree Affect the Search Result?
A thesaurus takes misspellings, synonyms, and child elements of a search term into account and thus improves or enlarges the search result:
- Assigned synonyms add terms to a search, which works in both directions.
- Example: A search for "bike" also results in objects tagged "bicycle", and a search for "bicycle" also results in "bike".
- Assigned misspellings result only in the corresponding term. This only works in one direction.
- Example: A search for "bycycle" results in objects tagged "bike" as well as "bycycle", but a search for "bike" finds no "bycycle".
If you want to find wrong spellings though, you need to define them as synonyms.
- Example: A search for "bycycle" results in objects tagged "bike" as well as "bycycle", but a search for "bike" finds no "bycycle".
- If a search term is the parent of other terms, the search is extended by its child element terms, plus their synonyms, and their children, recursively.
- Example: A search for "bike" results in objects tagged "bike", "electric bicycle" and "pedelec". But a search for "pedelec" does not find objects tagged "bike" or "electric bicycle".
A thesaurus processes the data hierarchically: General search terms return general results, and specific search terms return specific results.