pub trait Searcher: Send + Sync {
// Required method
fn search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 str,
scope: Option<&'life2 str>,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<ScoredEntry>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}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§
Sourcefn search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 str,
scope: Option<&'life2 str>,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<ScoredEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 str,
scope: Option<&'life2 str>,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<ScoredEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
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.
query is treated as natural-language text: implementations should
split it into terms and OR-match them (e.g. via FTS5 bm25 ranking)
rather than requiring every term to match. Query-language operator
syntax (AND, OR, NEAR, prefix *, quoted phrases, column
filters, etc.) must not be interpreted from query — operator
characters are treated as term separators, so arbitrary text never
produces a syntax error. A query with no usable terms (empty or
punctuation-only) returns an empty result set, not an error. The
special value crate::engine::MATCH_ALL_QUERY ("*") matches every
entry.
§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".