pub struct HybridQuery {
pub collection: String,
pub vector: Option<VectorQueryComponent>,
pub lexical: Option<LexicalQueryComponent>,
pub filters: Vec<MetadataFilter>,
pub fusion: FusionConfig,
pub rerank: Option<RerankConfig>,
pub limit: usize,
pub min_score: Option<f32>,
}Expand description
Builder for hybrid retrieval queries
Fields§
§collection: StringCollection to search
vector: Option<VectorQueryComponent>Vector search component
lexical: Option<LexicalQueryComponent>Lexical (BM25) search component
filters: Vec<MetadataFilter>Metadata filters
fusion: FusionConfigFusion configuration
rerank: Option<RerankConfig>Reranking configuration
limit: usizeResult limit
min_score: Option<f32>Minimum score threshold
Implementations§
Source§impl HybridQuery
impl HybridQuery
Sourcepub fn with_vector(self, embedding: Vec<f32>, weight: f32) -> Self
pub fn with_vector(self, embedding: Vec<f32>, weight: f32) -> Self
Add vector search component
Sourcepub fn with_vector_text(self, text: String, weight: f32) -> Self
pub fn with_vector_text(self, text: String, weight: f32) -> Self
Add vector search from text (requires embedding provider)
Sourcepub fn with_lexical(self, query: &str, weight: f32) -> Self
pub fn with_lexical(self, query: &str, weight: f32) -> Self
Add lexical (BM25) search component
Sourcepub fn with_lexical_fields(
self,
query: &str,
weight: f32,
fields: Vec<String>,
) -> Self
pub fn with_lexical_fields( self, query: &str, weight: f32, fields: Vec<String>, ) -> Self
Add lexical search with specific fields
Sourcepub fn filter_range(
self,
field: &str,
min: Option<SochValue>,
max: Option<SochValue>,
) -> Self
pub fn filter_range( self, field: &str, min: Option<SochValue>, max: Option<SochValue>, ) -> Self
Add range filter
Sourcepub fn with_fusion(self, method: FusionMethod) -> Self
pub fn with_fusion(self, method: FusionMethod) -> Self
Set fusion method
Sourcepub fn with_rrf_k(self, k: f32) -> Self
pub fn with_rrf_k(self, k: f32) -> Self
Set RRF k parameter
Sourcepub fn with_rerank(self, model: &str, top_n: usize) -> Self
pub fn with_rerank(self, model: &str, top_n: usize) -> Self
Enable reranking
Trait Implementations§
Source§impl Clone for HybridQuery
impl Clone for HybridQuery
Source§fn clone(&self) -> HybridQuery
fn clone(&self) -> HybridQuery
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for HybridQuery
impl RefUnwindSafe for HybridQuery
impl Send for HybridQuery
impl Sync for HybridQuery
impl Unpin for HybridQuery
impl UnsafeUnpin for HybridQuery
impl UnwindSafe for HybridQuery
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more