pub struct RRFFusion { /* private fields */ }Expand description
Reciprocal Rank Fusion combiner
Implementations§
Source§impl RRFFusion
impl RRFFusion
Sourcepub fn fuse(
&self,
vector_results: &[(DocId, f32)],
lexical_results: &[(DocId, f32)],
limit: usize,
keep_details: bool,
) -> Vec<SearchResult>
pub fn fuse( &self, vector_results: &[(DocId, f32)], lexical_results: &[(DocId, f32)], limit: usize, keep_details: bool, ) -> Vec<SearchResult>
Fuse vector and lexical search results
§Arguments
vector_results- Results from vector search, sorted by score descendinglexical_results- Results from lexical search, sorted by score descendinglimit- Maximum number of results to returnkeep_details- Whether to include component scores
§Returns
Fused results sorted by combined score descending
Sourcepub fn fuse_multi(
&self,
result_lists: &[(&[(DocId, f32)], f32)],
limit: usize,
) -> Vec<SearchResult>
pub fn fuse_multi( &self, result_lists: &[(&[(DocId, f32)], f32)], limit: usize, ) -> Vec<SearchResult>
Fuse multiple result lists with custom weights
CROSS-CRATE INVARIANT: the RRF kernel here — weight / (k + rank) with
rank 1-indexed — must stay numerically identical to
sochdb_query::fuse_rrf_weighted. The two crates are siblings (neither
depends on the other), so the formula is pinned independently in each by
a golden test (test_fuse_multi_rrf_formula_golden here and
test_fuse_rrf_weighted_is_1_indexed_and_weighted there); divergence on
either side fails that crate’s test.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RRFFusion
impl RefUnwindSafe for RRFFusion
impl Send for RRFFusion
impl Sync for RRFFusion
impl Unpin for RRFFusion
impl UnsafeUnpin for RRFFusion
impl UnwindSafe for RRFFusion
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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