Skip to main content

QueryExpander

Trait QueryExpander 

Source
pub trait QueryExpander: Send + Sync {
    // Required method
    fn expand(&self, query: &str) -> Vec<String>;
}
Expand description

Pluggable rule-based query expander (Tier-1 retrieval). No LLM, no network. Given a query it returns additional query variants; the caller runs one extra BM25 leg per variant and fuses them via RRF, bridging vocabulary gaps (“cell” ↔ “mobile” ↔ “phone”) — the poor-man’s semantic bridge for the edge/BM25-only profile where no embedder is installed. The built-in EnglishExpander is English-only; multilingual deployments install their own or leave expansion off (it is opt-in per query).

Required Methods§

Source

fn expand(&self, query: &str) -> Vec<String>

Query variants to also search, NOT including the original. Empty = no expansion. Implementations should keep this small and bounded.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§