Skip to content

LearnRetrieve

Synonym expansion

Glossary expansion · Acronym expansion

Rewriting a keyword query so each term also matches its listed synonyms or expansions, such as PO for purchase order.

In DocSlurpGlossary entry

On this page

Synonym expansion rewrites a keyword query using a list of equivalent terms. With a glossary entry nrr → net revenue retention, the query “nrr forecast” becomes (nrr OR net revenue retention) forecast, so a memo titled “Net Revenue Retention Forecast” matches even though it never says “NRR”. Good expansions match multi-word phrases first (“net revenue retention” as a unit) and then single words.

It is the cheapest fix for vocabulary mismatch when the mismatch is predictable: acronyms, product code names, internal team names, old and new names of the same service. These are exactly the terms an embedding model is least likely to know, since they never appeared in its training data.

The gotcha: operator precedence

An expansion is only as good as the query parser that reads it. In most engines AND binds tighter than OR, and some parsers ignore parentheses entirely. Postgres websearch_to_tsquery, for example, treats parentheses as punctuation, so (nrr OR net revenue retention) forecast is read as nrr OR (net AND revenue AND retention AND forecast): any passage containing “nrr” now matches, whether or not it mentions a forecast. Check how your engine parses the expanded string, or expand at the index level with a synonym dictionary instead of rewriting query text.

The other gotcha is maintenance. A glossary covers only the pairs someone wrote down, and a too-broad entry (site → location) makes every search noisier.

DocSlurp applies project synonyms and a per-request glossary to the keyword branch only; the vector branch embeds the original question.

In DocSlurp

In DocSlurp

Project synonyms and a per-request glossary rewrite the keyword query, matching phrases of up to three words: po approval becomes (po OR purchase order) approval (core/server/src/search/synonym.ts). The vector query is not expanded.

Sources

Jump to