Expand description
The in-memory candidate index: trigram -> set of file IDs, plus a file table.
This is the “narrow the candidate set” half of rgx. Building, querying, incremental update, and persistence are kept separable from the walk and from ripgrep so each can be tested in isolation.
Incremental updates are deliberately simple and lean on the confirm step for correctness: when a
file changes we add its current trigrams (so no new-trigram query can miss it); trigrams that
the file no longer contains linger in their posting lists, which only ever produces an extra
candidate that ripgrep then filters out. Deleted files are tombstoned (live = false) so they
stop being candidates. See docs/index-and-storage.md sections 3.1 and 5.
Structs§
Functions§
- walk_
builder - A
WalkBuilderthat enumerates exactly the filesrgwould underroot. The crate defaults already match ripgrep (skip hidden; honor.gitignore/.ignore/.git/info/excludeand the global gitignore; read parent ignores; don’t follow symlinks); the one thing thergbinary adds on top of the crate is the.rgignorecustom ignore name. Both the index walk and thefull_scanfallback go through here so they can’t drift fromrg— or from each other. Seedocs/indexing.md(What the walk includes). - walk_
files - Collect the files ripgrep would search under
root, sorted so file IDs are deterministic.