Skip to main content

Module search

Module search 

Source
Expand description

Recursive search for datasets below a directory.

The home screen’s filter is a fuzzy match over rows that are already listed. This module is what puts more rows in front of it: one bounded walk of the working directory, run once in the background, whose result is then filtered in memory like everything else. Nothing here is repeated per keystroke — a walk per character is how a file finder becomes slow on exactly the trees where it matters.

Every limit exists because some real directory violates it. See [Limits].

The walk keeps every data file it finds, and the filter is scored against that index off the UI thread (score). The cap on what is listed counts matches, not files: a file that matches is never lost behind thousands that do not.

Structs§

Matches
What the filter matched among the files a walk kept.
Outcome
How far a walk got, and why it stopped.

Constants§

MAX_INDEXED
The most files one walk keeps. The time budget bounds a walk first in practice; this bounds its memory on a tree fast enough to list a million names inside it.

Functions§

score
Score query against the files in index, keeping the best limit to list.
search_root
Where a search should start, given where the user is.
walk
Walk root for datasets, handing batches to emit as they are found.
walk_up_to
walk, keeping at most cap files.
walk_with_specs
walk, keeping the files formats reads as well, as the listing names them: by a spec’s glob, or by its magic in the first bytes of a file whose name says nothing, at most [crate::discover::MAX_SNIFFS_PER_DIR] of them a directory.