Expand description
AST → compiled execution plan. Each AND group gets a driver — the most selective positive literal, executed as a single SIMD sweep over the name pool — plus residual matchers ordered by evaluation cost (numeric filters → memmem → regex → path).
Structs§
- CTerm 🔒
- Compiled
Group 🔒 - Compiled
Query - An executable plan: one compiled AND group per OR clause, plus the path pools the sweep must materialize to evaluate them.
Enums§
- Case
Mode - How the query is matched against names (
FmfQueryOptions.case_mode). - Compile
Error - Why a query failed to compile into an executable plan.
- Driver 🔒
- Candidate generator for one AND group — a single sweep over the folded
name pool (the only contiguous one) instead of a per-entry matcher call.
Needles are always folded; a case-exact source term makes the sweep a
superset and its exact comparison runs as a residual
(
CompiledGroup::driver_exact). - Matcher 🔒
- Regex
Scope - Which haystack a whole-query regex runs against
(
FmfQueryOptions.regex_modebit1; ADR-0023). - Wild
Shape 🔒 lit*/*lit/*lit*style patterns collapse to anchored byte comparisons; everything else stays a regex.
Constants§
- REGEX_
DFA_ 🔒SIZE_ LIMIT - REGEX_
SIZE_ 🔒LIMIT - Compile-time bounds on a user regex (ADR-0023). The
regexcrate matches in guaranteed linear time (finite automata, no backtracking) — so there is noReDoSexecution blowup — but a pathological pattern can still demand a large program/DFA at build time. We index file names only (p99 ≈110 B), so a legitimate name regex never approaches 1 MiB; capping there turns a memory-DoS pattern into a cleanCompiledTooBig→FMF_E_QUERY_SYNTAXrejection (it flows throughCompileError::Regexunchanged), instead of letting the elevated service compile it. Both default higher (10/2 MiB).
Functions§
- build_
regex 🔒 - classify_
wildcard 🔒 - compile
- Compile a parsed
Astinto an executableCompiledQuery. - compile_
term 🔒 - compile_
whole_ regex - Compile the entire query text as one regex (whole-query regex mode).
- driver_
for 🔒 - Build the sweep driver from a term, leaving the term intact (kept as
CompiledGroup::driver_term). Returns the driver and whether it fully checks the term — false for a case-exact term: the sweep folds its needle (sound: an original-case match always implies the folded match) and the exact comparison runs as a residual. - driver_
score 🔒 - Driver candidate score — longer literals are more selective. Returns None for matchers that cannot drive a pool sweep.
- fold_
exact_ 🔒needle - Fold a case-exact needle for the superset sweep. Needles always
originate from the query
&str, so the bytes are valid UTF-8; the fold’s length preservation keeps prefix/suffix anchors sound. - fold_
needle 🔒 - insensitive 🔒
- Smart-case decision for one needle.
- regex_
name_ 🔒prefilter - Extract a required literal factor from a name regex and turn it into a folded-pool substring sweep — the same linear sweep every literal query uses (ADR-0002), so regex stays off the full scan without any standing index (ADR-0023).
- regex_
prefilter_ 🔒driver - When a group has no literal driver, try to drive it from a positive name
regex’s required literal. The regex matcher stays in
termsas the residual that confirms each candidate, sodriver_termisNone. - regex_
prefilter_ 🔒enabled - Kill switch for the regex literal prefilter (
FMF_REGEX_PREFILTER=0) — forces literal-less and literal-bearing regex groups onto the chunked full scan. A field escape hatch if a prefilter soundness bug ever surfaces (the same shape asFMF_QUERY_CACHE, ADR-0023). - substring_
finder 🔒 - wildcard_
to_ 🔒regex_ body - Translate a
*/?pattern into a regex body (no anchors).