Skip to main content

Searcher

Trait Searcher 

Source
pub trait Searcher: Send + Sync {
    // Required method
    fn search(
        &self,
        query: &str,
        scope: Option<&str>,
        limit: usize,
    ) -> Result<Vec<ScoredEntry>>;
}
Expand description

Trait for searching context entries by relevance.

Implementations must be thread-safe (Send + Sync) to support concurrent access from multiple worker threads.

Required Methods§

Source

fn search( &self, query: &str, scope: Option<&str>, limit: usize, ) -> Result<Vec<ScoredEntry>>

Search for entries matching query, optionally restricted to scope, returning at most limit results ordered by descending relevance score.

scope = None searches every entry regardless of scope (global recall). scope = Some(s) restricts results to entries whose scope equals s.

§Errors

Returns an error if the underlying search fails.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§