pub struct HybridIndex { /* private fields */ }Expand description
Hybrid search index combining vector and keyword search
Implementations§
Source§impl HybridIndex
impl HybridIndex
Sourcepub fn new(config: HybridConfig) -> Self
pub fn new(config: HybridConfig) -> Self
Create a new hybrid search index
Sourcepub fn build(
&mut self,
embeddings: &HashMap<String, Vec<f32>>,
texts: &HashMap<String, String>,
) -> Result<()>
pub fn build( &mut self, embeddings: &HashMap<String, Vec<f32>>, texts: &HashMap<String, String>, ) -> Result<()>
Build hybrid index from embeddings and texts
Sourcepub fn search(
&self,
query_vector: &[f32],
query_text: &str,
k: usize,
) -> Result<Vec<HybridSearchResult>>
pub fn search( &self, query_vector: &[f32], query_text: &str, k: usize, ) -> Result<Vec<HybridSearchResult>>
Hybrid search combining vector and keyword results
Uses Reciprocal Rank Fusion (RRF) to combine results.
Sourcepub fn weighted_search(
&self,
query_vector: &[f32],
query_text: &str,
k: usize,
) -> Result<Vec<HybridSearchResult>>
pub fn weighted_search( &self, query_vector: &[f32], query_text: &str, k: usize, ) -> Result<Vec<HybridSearchResult>>
Search using weighted linear combination instead of RRF
Sourcepub fn vector_search(
&self,
query: &[f32],
k: usize,
) -> Result<Vec<SearchResult>>
pub fn vector_search( &self, query: &[f32], k: usize, ) -> Result<Vec<SearchResult>>
Vector-only search (alpha = 1.0)
Sourcepub fn keyword_search(
&self,
query: &str,
k: usize,
) -> Result<Vec<HybridSearchResult>>
pub fn keyword_search( &self, query: &str, k: usize, ) -> Result<Vec<HybridSearchResult>>
Keyword-only search (alpha = 0.0)
Sourcepub fn get_stats(&self) -> HybridStats
pub fn get_stats(&self) -> HybridStats
Get index statistics
Auto Trait Implementations§
impl Freeze for HybridIndex
impl RefUnwindSafe for HybridIndex
impl Send for HybridIndex
impl Sync for HybridIndex
impl Unpin for HybridIndex
impl UnwindSafe for HybridIndex
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> 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