Skip to main content

Module query

Module query 

Source
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 next provably fit inside the result set of prev? When it does (and the index generation is unchanged), the engine refines the cached prev ids instead of scanning — the incremental-typing fast path.
sweep 🔒

Structs§

Ast
OR of AND groups: a b | c[[a, b], [c]].
CompiledQuery
An executable plan: one compiled AND group per OR clause, plus the path pools the sweep must materialize to evaluate them.
QueryOptions
Per-query options controlling sort order, case handling, visibility, and whole-query regex mode — the engine-side form the wire options convert into.
SearchMetrics
Per-volume stage timings for crate::metrics::QueryTrace.
SearchResult
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.
WindowsLocalResolver
Local-time-zone resolver backed by the Windows time-zone/DST rules.

Enums§

CaseMode
How the query is matched against names (FmfQueryOptions.case_mode).
CompileError
Why a query failed to compile into an executable plan.
ParseError
Reasons parse rejects malformed query text.
RegexScope
Which haystack a whole-query regex runs against (FmfQueryOptions.regex_mode bit1; ADR-0023).
Term
A single matchable condition within an AND group of the Ast.

Traits§

DateResolver
Converts a civil date (midnight) to FILETIME ticks.

Functions§

compile
Compile a parsed Ast into an executable CompiledQuery.
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.