Skip to main content

LexiconScorer

Trait LexiconScorer 

Source
pub trait LexiconScorer: Send + Sync {
    // Required method
    fn score(&self, entry: &ContextEntry, query: &str) -> f32;
}
Expand description

Domain-specific importance scorer, injected at construction time.

Returns an additive boost in the range (-1.0, +∞). The engine combines this with the BM25 + recency score as: final = base * (1.0 + boost.max(-1.0)).

A boost of 0.0 (the default) leaves scores unchanged. A boost of 1.0 doubles the base score. A boost of -1.0 zeroes it (floor).

Implementations must be Send + Sync — the scorer runs inside tokio::task::spawn_blocking on the hot assemble path.

Required Methods§

Source

fn score(&self, entry: &ContextEntry, query: &str) -> f32

Score a single entry given the current query string.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§