Skip to main content

scan

Function scan 

Source
pub fn scan(
    root: &Path,
    skip: &HashSet<String>,
    deadline: Option<Instant>,
    needle: Option<&[u8]>,
) -> Vec<FileSymbols>
Expand description

Live, budgeted scan (search Layer 4): stream-walk root on the same fused [stream_walk] engine as the indexer, parsing source files and returning the parsed FileSymbols without touching the store — so rq answers at zero coverage. Bounded and filtered:

  • stop once deadline passes;
  • skip any file whose repo-relative path is in skip (already indexed);
  • when needle is set, parse only files containing it (case-insensitive substring) — the ripgrep-style pre-filter that skips the tree-sitter parse on files that can’t hold an exact/prefix/substring match. needle is None for the fuzzy fallback: an abbreviation (usruser) isn’t a substring of its match, so it can’t be content-filtered; callers retry unfiltered when a filtered scan comes up empty.

The caller decides the fate of the result, which is exactly where the persist-or-not policy lives: a warming git repo persists them via replace_files (folds the scan into the index — demand-first coverage); a non-git dir ranks them in-memory and discards them (there’s no index to fold into). Streaming — never collect-then-parse — keeps a scan too big to finish from coming up empty.