pub trait Embedder: Send + Sync {
// Required methods
fn embed(&self, text: &str) -> Vec<f32>;
fn dim(&self) -> usize;
fn name(&self) -> &str;
// Provided methods
fn is_semantic(&self) -> bool { ... }
fn embed_batch(&self, texts: &[String]) -> Vec<Vec<f32>> { ... }
}Expand description
Backend-neutral embedding seam used by the store’s search implementation.
The deterministic lexical backend is always available. Higher-quality
implementations may be injected through StoreHooks without changing the
search interface or any transport.
Required Methods§
fn embed(&self, text: &str) -> Vec<f32>
fn dim(&self) -> usize
fn name(&self) -> &str
Provided Methods§
Sourcefn is_semantic(&self) -> bool
fn is_semantic(&self) -> bool
Whether this backend ranks by meaning rather than by surface form.
Defaults to false: the claim is earned, never inherited. A backend
that returns true is asserting it can rank a semantically related
document above a lexically similar decoy, and
conformance::audit_semantic_claim is the bar that assertion is
measured against.
The default direction matters. Under-claiming costs a caller some
recall it could have had; over-claiming makes
SearchResponse::semantic_floor lie, silently converts a
SearchMode::Semantic query into surface matching, and suppresses
the fallback notice that would otherwise tell the caller what
happened. So an unconsidered backend degrades loudly instead of
claiming quietly.
fn embed_batch(&self, texts: &[String]) -> Vec<Vec<f32>>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".