Skip to main content

compile_text_query

Function compile_text_query 

Source
pub fn compile_text_query(raw: impl Into<String>) -> CompiledQuery
Expand description

Compile a raw query into an FTS5 MATCH expression.

IR-C (2026-06-10b/c, performance-output-and-compare.md): the production arm was an AND of every whitespace token, which near-zeroes recall on natural-language questions (every token must be present). The validated recipe is content-OR — OR over the content tokens (stopwords stripped) — which any-token-matches and lets bm25() rank by overlap, the way the same-dataset BM25 baselines (EnronQA/QAConv) are run.

All-stopword / symbol-only / sub-3-char queries (no content tokens) fall back to an OR over the raw whitespace tokens as injection-safe quoted phrases, so such a query still searches instead of returning nothing.