Skip to main content

Searcher

Struct Searcher 

Source
pub struct Searcher { /* private fields */ }
Expand description

Loaded, searchable index.

Implementations§

Source§

impl Searcher

Source

pub fn open(paths: &Paths) -> Result<Searcher>

Open the index described by meta.

Source

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.

Source

pub fn search(&self, query: &SearchQuery) -> Result<Vec<SearchHit>>

Run a content search.

Source

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.

Source

pub fn outline(&self, rel_path: &str) -> Result<Vec<SymbolHit>>

Return the symbol outline for a single file (by relative path).

Source

pub fn references( &self, name: &str, limit: usize, offset: usize, ) -> Result<Vec<SearchHit>>

Find references to an identifier (whole-word occurrences across the repo).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn blame(&self, rel_path: &str, line: u32) -> Result<BlameLine>

Blame a single line: the commit and author that last touched it.

Source

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.

Source

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.

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.

Source

pub fn summary(&self) -> RepoSummary

Summarize the indexed repository.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more