Skip to main content

SearchEngine

Trait SearchEngine 

Source
pub trait SearchEngine {
    // Required methods
    fn add_document(&mut self, id: &str, fields: &[(&str, &str, f64)]);
    fn search(&self, query: &str, limit: usize) -> Vec<SearchResult>;
}
Expand description

Trait for search backends. Implemented by BM25Index (in-memory fallback) and can be implemented by FTS5-backed stores when the db feature is enabled.

Required Methods§

Source

fn add_document(&mut self, id: &str, fields: &[(&str, &str, f64)])

Add a document with weighted fields. Each field is (field_name, field_value, field_weight).

Source

fn search(&self, query: &str, limit: usize) -> Vec<SearchResult>

Search for documents matching the query, returning at most limit results sorted by descending relevance score.

Implementors§