pub struct Searcher { /* private fields */ }Expand description
Loaded, searchable index.
Implementations§
Source§impl Searcher
impl Searcher
Sourcepub fn open_reusing(paths: &Paths, prev: &Searcher) -> Result<Searcher>
pub fn open_reusing(paths: &Paths, prev: &Searcher) -> Result<Searcher>
Open the index, reusing as much of prev as possible: segments whose
id is unchanged share their parsed tables and lookup maps (only the
live bitmap is re-read), and the verification content cache carries
over warm. Sound because segment ids are never reused, so an id always
names the same immutable content. This is what makes the daemon’s
per-save searcher hot-swap cheap on large repositories.
Sourcepub fn symbols(&self, query: &SymbolQuery) -> Result<Vec<SymbolHit>>
pub fn symbols(&self, query: &SymbolQuery) -> Result<Vec<SymbolHit>>
Look up symbols by name. Exact queries go through the per-segment name index (O(results)); fuzzy queries scan, since prefix/substring/ subsequence matching has no exact key.
Sourcepub fn outline(&self, rel_path: &str) -> Result<Vec<SymbolHit>>
pub fn outline(&self, rel_path: &str) -> Result<Vec<SymbolHit>>
Return the symbol outline for a single file (by relative path).
Sourcepub fn references(
&self,
name: &str,
limit: usize,
offset: usize,
) -> Result<Vec<SearchHit>>
pub fn references( &self, name: &str, limit: usize, offset: usize, ) -> Result<Vec<SearchHit>>
Find references to an identifier (whole-word occurrences across the repo).
Sourcepub fn references_resolved(
&self,
name: &str,
limit: usize,
offset: usize,
) -> Vec<RefHit>
pub fn references_resolved( &self, name: &str, limit: usize, offset: usize, ) -> Vec<RefHit>
Resolved references to name: its definitions, call sites, and imports,
drawn from the structural reference index (not text matching). Ranked
definitions first, then calls, then imports.
Sourcepub fn callees(&self, name: &str, limit: usize, offset: usize) -> Vec<CallSite>
pub fn callees(&self, name: &str, limit: usize, offset: usize) -> Vec<CallSite>
Call sites inside name’s body: what name calls. Built by locating
the definition(s) of name and collecting “call” refs within range.
Sourcepub fn callers(&self, name: &str, limit: usize, offset: usize) -> Vec<CallSite>
pub fn callers(&self, name: &str, limit: usize, offset: usize) -> Vec<CallSite>
Call sites that target name: who calls it. Each is attributed to its
enclosing caller symbol when one can be determined.
Sourcepub fn blast_radius(
&self,
name: &str,
depth: u32,
limit: usize,
) -> Vec<ImpactNode>
pub fn blast_radius( &self, name: &str, depth: u32, limit: usize, ) -> Vec<ImpactNode>
Blast radius: the symbols transitively affected if name changes, found
by walking the reverse call graph (callers, then their callers, …) up
to depth hops. Distance 0 is name’s own definition(s).
Resolution is by name, so results are an approximation that can include unrelated same-named symbols; it is a guide, not a proof.
Sourcepub fn definition(
&self,
rel_path: &str,
line: u32,
col: u32,
) -> Result<Vec<DefHit>>
pub fn definition( &self, rel_path: &str, line: u32, col: u32, ) -> Result<Vec<DefHit>>
Typed go-to-definition: resolve the identifier at rel_path:line:col to
its most likely definition(s), combining scope/usage context with the
global symbol table. Returns candidates ranked by confidence; the unique
best is flagged resolved. Falls back to whole-word text hits (marked
unresolved) when the name has no indexed definition.
Sourcepub fn references_of(
&self,
rel_path: &str,
line: u32,
col: u32,
) -> Result<Vec<RefHit>>
pub fn references_of( &self, rel_path: &str, line: u32, col: u32, ) -> Result<Vec<RefHit>>
Resolved references for the identifier at rel_path:line:col: its
definitions, call sites, and imports across the repo.
Sourcepub fn read_snippet(
&self,
rel_path: &str,
start_line: u32,
end_line: u32,
context: u32,
) -> Result<Snippet>
pub fn read_snippet( &self, rel_path: &str, start_line: u32, end_line: u32, context: u32, ) -> Result<Snippet>
Read a slice of a file with surrounding context lines.
Sourcepub fn context_pack(&self, task: &str, budget_tokens: u64) -> ContextPack
pub fn context_pack(&self, task: &str, budget_tokens: u64) -> ContextPack
Build a token-budgeted context pack for task: the symbols (with
signatures and code snippets) most relevant to the task, ranked by
lexical relevance and call-graph centrality, plus their immediate
dependency neighborhood. Designed to hand an agent exactly the code it
needs without reading whole files.
Sourcepub fn blame(&self, rel_path: &str, line: u32) -> Result<BlameLine>
pub fn blame(&self, rel_path: &str, line: u32) -> Result<BlameLine>
Blame a single line: the commit and author that last touched it.
Sourcepub fn symbol_history(&self, name: &str, limit: usize) -> Result<SymbolHistory>
pub fn symbol_history(&self, name: &str, limit: usize) -> Result<SymbolHistory>
The commit history of a symbol: resolve name to its definition and list
the commits that touched that line range, newest first.
Sourcepub fn changed_since(&self, rev: &str) -> Result<Vec<ChangedSymbols>>
pub fn changed_since(&self, rev: &str) -> Result<Vec<ChangedSymbols>>
Files changed since rev, annotated with the symbols defined in each
(from the index) so an agent sees the affected API surface at a glance.
Sourcepub fn structural_search(
&self,
pattern: &str,
lang: &str,
limit: usize,
offset: usize,
) -> Result<Vec<StructHit>>
pub fn structural_search( &self, pattern: &str, lang: &str, limit: usize, offset: usize, ) -> Result<Vec<StructHit>>
Structural (AST) search: match a tree-sitter query or $NAME
meta-variable pattern across documents of one language. Literal tokens in
the pattern prune candidates via the trigram index before parsing.
Sourcepub fn summary(&self) -> RepoSummary
pub fn summary(&self) -> RepoSummary
Summarize the indexed repository.
Auto Trait Implementations§
impl !Freeze for Searcher
impl RefUnwindSafe for Searcher
impl Send for Searcher
impl Sync for Searcher
impl Unpin for Searcher
impl UnsafeUnpin for Searcher
impl UnwindSafe for Searcher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more