Skip to main content

Module index

Module index 

Source
Expand description

Indexing — walk a checkout, extract symbols, persist incrementally.

Decoupled from search: it only writes. Unchanged files (same content hash) are skipped, and coverage is recorded so search can judge its own confidence.

Structs§

Stats
Outcome of an indexing run.

Enums§

Refresh
Result of revalidating a single file against what’s on disk.

Functions§

branch_changed_files
Repo-relative files you’re working on this branch: committed changes since the branch diverged from the trunk, plus uncommitted edits. Empty on the trunk itself (where it isn’t a useful signal) or outside git. Feeds the branch ranking boost — necessarily a few git calls, but gated to feature branches.
detect_identity
Best-effort repository identity: upstream git remote, else the local path.
git_head
The current HEAD commit sha, or None outside a git work tree.
index_budgeted
Opportunistic, time-bounded indexing — warm the index a little per call so no single query blocks on a full walk of a large repo. active (branch) files are parsed first and ignore the budget (the working set stays fresh); then the walk streams the rest, honoring budget. When query is set, files whose path matches it are parsed first (a cheap, in-memory reorder of the candidate list — no file reads), so a relevant symbol indexes fast. A sweep that finishes within budget marks coverage complete, else warming.
index_budgeted_cancellable
Like index_budgeted, but the pass stops promptly when cancel is set — the interactive cold-start escalation (see the CLI’s search path) runs a long, generous-budget warm and lets the user abort it with Ctrl-C without losing the batches already committed.
index_path
Index the whole repository rooted at root.
index_under
Index root, or — when subdirs is non-empty — only those repo-relative subtrees of it. Unbounded: an explicit index is thorough. A whole-repo index also reconciles deletions; a subtree index is a seed (it gets those files in first) that leaves coverage warming, so normal warming continues over the rest of the repo through use.
is_dirty
Whether the work tree has uncommitted changes to tracked files (staged or unstaged). --untracked-files=no skips the work-tree-wide untracked-file scan — the expensive, cold-cache-sensitive part of git status on a large repo (it walks to classify every path against .gitignore). This runs on every search to gate warming, so the scan dominated query-time variance.
is_git_repo
Whether root is inside a git work tree. Implicit (opportunistic) indexing is gated on this so a stray query never walks a non-repo directory. Native (no git fork) — it runs on every search.
parse_jobs
Parse workers for one indexer pass — the configured value, else RQ_JOBS, else an auto default. Parsing is CPU-bound but writes serialize through one SQLite writer, so flooding every core rarely pays; the default caps at 8.
refresh_file
Lazily revalidate one indexed file against disk: re-extract it if its content changed. This is the staleness check search runs over its top results.
repo_root
The git work-tree root at or above path — the nearest ancestor holding a .git entry — found without shelling out. .git may be a directory or a file (worktrees, submodules), so we test existence either way. None when path is not inside a work tree.
scan
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:
set_parse_jobs
Set the parse-worker count (from --jobs/RQ_JOBS); 0 restores auto.