Skip to main content

Module search

Module search 

Source
Expand description

Search — the staged ranking pipeline.

Layers 1–3 (exact/prefix, abbreviation-aware fuzzy, path) over the index, scored by an additive, --explain-able scorer. Layers 4–5 (live scan, opportunistic extraction) and true streaming/early-exit arrive in phase 2; for now the candidate set is gathered once and ranked.

Structs§

ActiveFiles
Files you’re working on this branch — those that differ from the trunk — plus the directories holding them. Symbols in those files (or their directory neighbors) get a branch boost. Empty on the trunk / outside git.
Boosts
Dynamic, context-dependent boosts computed by crate::search (which owns the time math and store lookups). Kept out of the pure match scoring so each signal can be added without threading more parameters.
Feature
One named contribution to a score.
Hit
A ranked search result. Serializes for --json / --ndjson.
Scored
A scored candidate: total plus the per-feature breakdown.

Functions§

live_search
Layer 4: scan root live (no index required) and return ranked hits. Results are treated as the current repo, so the current-repo boost applies. skip names already-indexed files to ignore, and deadline bounds the scan — both empty/None for an unbounded scan of a never-indexed directory. When prefilter is set, only files containing the query (substring) are parsed — fast for exact/prefix/substring queries, but blind to fuzzy abbreviations, so callers retry with prefilter = false if a filtered scan finds nothing.
match_positions
The char indices in name that query matched, from the best alignment — for highlighting what matched. Empty if query isn’t a subsequence.
merge
Merge two ranked lists, de-duplicating by location and name (keeping the higher score), then re-rank and truncate. Used to blend index and live-scan results.
search
Search the index for query, returning up to limit ranked hits. current_repo_id (if any) boosts results from the repository you’re in; active boosts files you’re changing on the current branch.