expand_query#
- dscat.queries.expand_query(cat, query, raw)[source]#
Build an FTS5 MATCH expression from a free-text query.
Each query token becomes an OR-group of the token (as a prefix match) and its synonyms, and the groups are ANDed together. With
rawset, the query is returned unchanged.- Parameters:
cat (
dscat.index.Catalogue) – Open catalogue, read for synonym expansions.query (
str) – Free-text query, or a raw MATCH expression whenrawis set.raw (
bool) – Returnqueryunchanged.
- Returns:
An FTS5 MATCH expression.
- Return type:
- Raises:
ValueError – When
queryhas no searchable tokens.