#[non_exhaustive]pub struct RetrievalQuery {
pub text: String,
pub top_k: usize,
pub min_score: Option<f32>,
pub filter: Option<VectorFilter>,
}Expand description
Declarative description of one retrieval call.
Carries the text query plus optional knobs: a metadata filter, a
minimum score floor, and a top-k cap. Future hybrid-search
dimensions (per-field boosts, dense+keyword fusion, reranker
hints) ride on #[non_exhaustive] without breaking call sites.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.text: StringFree-text query. Backends interpret it however they like — dense vector embed-and-search, BM25 token match, hybrid fusion.
top_k: usizeMaximum number of hits to return. Backends truncate at this cap; exceeding it is a backend bug.
min_score: Option<f32>Minimum similarity score required to include a hit. None
surfaces every hit regardless of score; useful when score
semantics differ across backends. Comparable only within a
single query’s result set.
filter: Option<VectorFilter>Metadata predicate. None is identity (no filter). Backends
that cannot honour the supplied VectorFilter variant fall
back to filterless retrieval and emit a LossyEncode-style
warning at the operator layer.
Implementations§
Source§impl RetrievalQuery
impl RetrievalQuery
Sourcepub fn new(text: impl Into<String>, top_k: usize) -> Self
pub fn new(text: impl Into<String>, top_k: usize) -> Self
Build a query with sensible defaults — no filter, no floor, top-k cap supplied.
Sourcepub fn with_filter(self, filter: VectorFilter) -> Self
pub fn with_filter(self, filter: VectorFilter) -> Self
Attach a metadata filter. Builder-style.
Sourcepub const fn with_min_score(self, min_score: f32) -> Self
pub const fn with_min_score(self, min_score: f32) -> Self
Attach a minimum-score floor. Builder-style.
Trait Implementations§
Source§impl Clone for RetrievalQuery
impl Clone for RetrievalQuery
Source§fn clone(&self) -> RetrievalQuery
fn clone(&self) -> RetrievalQuery
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more