Expand description
Query engine: text → AST → compiled matchers → parallel scan → materialized, sort-ordered result (docs/ARCHITECTURE.md).
Syntax (core):
space=AND, |=OR (weakest), !=NOT, "..."=phrase, */? wildcards
(match the whole name), a \ inside a term switches it to path matching,
and the filters ext:, path:, size:, dm:, regex:, file:,
folder:.
Modules§
- ast 🔒
- Tokenizer and parser: query text →
Ast(OR of AND groups). - compile 🔒
- 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).
- dates 🔒
- Civil-date ↔ FILETIME conversion for
dm:filters. - exec 🔒
- Query execution. Each AND group is driven by a single SIMD sweep over the contiguous name pool (pool-scan / prefix / suffix drivers) that yields a sparse candidate list; residual matchers then verify only those candidates. Groups without a usable literal fall back to a chunked full scan, and the empty query walks the permutation directly. Results materialize as O(1)-pageable, sort-ordered id arrays (docs/ARCHITECTURE.md “query-time materialization”).
- matchers 🔒
- memo 🔒
- subsume 🔒
- Query subsumption: does the result set of
nextprovably fit inside the result set ofprev? When it does (and the index generation is unchanged), the engine refines the cachedprevids instead of scanning — the incremental-typing fast path. - sweep 🔒
Structs§
- Ast
- OR of AND groups:
a b | c→[[a, b], [c]]. - Compiled
Query - An executable plan: one compiled AND group per OR clause, plus the path pools the sweep must materialize to evaluate them.
- Query
Options - Per-query options controlling sort order, case handling, visibility, and whole-query regex mode — the engine-side form the wire options convert into.
- Search
Metrics - Per-volume stage timings for
crate::metrics::QueryTrace. - Search
Result - One volume’s query result: the matching ids plus the index generations they were computed against (for staleness checks and incremental refine).
- UtcResolver
- Pure UTC resolver — deterministic, used by unit tests.
- Windows
Local Resolver - Local-time-zone resolver backed by the Windows time-zone/DST rules.
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.
- Parse
Error - Reasons
parserejects malformed query text. - Regex
Scope - Which haystack a whole-query regex runs against
(
FmfQueryOptions.regex_modebit1; ADR-0023). - Term
- A single matchable condition within an AND group of the
Ast.
Traits§
- Date
Resolver - Converts a civil date (midnight) to FILETIME ticks.
Functions§
- compile
- Compile a parsed
Astinto an executableCompiledQuery. - compile_
whole_ regex - Compile the entire query text as one regex (whole-query regex mode).
- derived_
cache_ bytes - Bytes currently held by this index’s derived caches (offset table +
dir-path memos), for the RAM accounting in
IndexStats. Probes only — never builds. - parse
- Tokenize and parse query text into an
Ast. - prewarm
- Build the pool offset table ahead of the first query — the engine calls this once a volume turns Ready so no keystroke pays the cold cost.
- search
- Execute a compiled query against one volume index.