Skip to main content

Module query

Module query 

Source
Expand description

Parsed recall query: the single owner of the query→atoms mapping shared by the DB prefilter and the nucleo fuzzy stage.

The invariant this module exists to hold in one place: the LIKE conditions from like_patterns() must accept every row the nucleo pattern from scoring_pattern() can match (the prefilter is a strict superset of the fuzzy stage). Both sides derive from the same normalization and the same atom split, so they cannot drift apart.

Known bounded exception: nucleo’s Normalization::Smart folds accented haystack chars onto ASCII query chars (cafe matches café); a byte-wise LIKE cannot express that, so a haystack whose only match is via folding can still be prefiltered away. Non-ASCII query chars are simply not required by the prefilter (requiring less always preserves the superset).

Structs§

RecallQuery
A recall query parsed once into nucleo-style atoms.

Functions§

atomize 🔒
Split a normalized query into atoms the way nucleo’s Pattern::parse does: unescaped whitespace separates atoms, \ keeps a space inside one. Backslashes are preserved for required_chars to resolve, so a trailing \$ is still distinguishable from a suffix anchor.
is_recall_separator
Characters treated as word separators in recall search. - covers flag forms (--release), * covers glob queries, and / covers path components so a match after any of them scores like a whitespace boundary rather than nucleo’s (lower) delimiter boundary.
is_subsequence 🔒
Whether needle’s chars appear in hay in order, ignoring ASCII case (matching LIKE’s NOCASE collation).
like_pattern 🔒
Build a LIKE pattern matching required as an ordered subsequence: “gcm” becomes “%g%c%m%”.
normalize_recall_char
Map separator chars to space so nucleo treats them as word boundaries; pass through everything else.
required_chars 🔒
The chars one positive atom requires the haystack to contain in order, with fzf-style operators stripped (^/' prefix, unescaped $ suffix) and escapes resolved. None for negated atoms and atoms that reduce to nothing. Non-ASCII chars are dropped: nucleo may satisfy them via Unicode folding that LIKE can’t express, and requiring less keeps the superset.