pub struct HybridEngine {
pub alpha: f32,
pub strategy: FusionStrategy,
pub oversample_factor: usize,
}Fields§
§alpha: f32Weight for dense scores (1.0 = pure dense, 0.0 = pure sparse).
strategy: FusionStrategyFusion strategy to use.
oversample_factor: usizeOversampling factor: dense retrieves k * oversample_factor candidates before sparse re-scoring.
Implementations§
Source§impl HybridEngine
impl HybridEngine
Sourcepub fn new(
alpha: f32,
strategy: FusionStrategy,
oversample_factor: usize,
) -> Self
pub fn new( alpha: f32, strategy: FusionStrategy, oversample_factor: usize, ) -> Self
Construct a new engine.
§Panics
Panics if alpha is not in [0.0, 1.0] or oversample_factor < 1.
These are programming errors, not runtime errors.
Sourcepub fn fuse(
&self,
dense_results: Vec<(VectorId, f32)>,
sparse_results: Vec<(VectorId, f32)>,
k: usize,
) -> Result<Vec<SearchResult>>
pub fn fuse( &self, dense_results: Vec<(VectorId, f32)>, sparse_results: Vec<(VectorId, f32)>, k: usize, ) -> Result<Vec<SearchResult>>
Fuse pre-computed dense and sparse result lists into a single ranked list.
- Both empty → empty result.
- Dense only → pure dense path; sparse_score = None.
- Sparse only → pure sparse path; dense_score = None.
- Both present → fuse with
self.strategy.
dense_score and sparse_score in each SearchResult hold the
original (pre-normalization) scores. score holds the fused value.
payload and text are left as Null / None — caller hydrates.
Sourcepub fn compute_oversample_k(&self, k: usize) -> usize
pub fn compute_oversample_k(&self, k: usize) -> usize
How many dense candidates to fetch before sparse re-scoring.
Returns k * oversample_factor (minimum k).
Trait Implementations§
Source§impl Clone for HybridEngine
impl Clone for HybridEngine
Source§impl Debug for HybridEngine
impl Debug for HybridEngine
Source§impl Default for HybridEngine
impl Default for HybridEngine
Source§impl<'de> Deserialize<'de> for HybridEngine
impl<'de> Deserialize<'de> for HybridEngine
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for HybridEngine
impl RefUnwindSafe for HybridEngine
impl Send for HybridEngine
impl Sync for HybridEngine
impl Unpin for HybridEngine
impl UnsafeUnpin for HybridEngine
impl UnwindSafe for HybridEngine
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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