pub enum FusionStrategy {
Rrf {
k: usize,
},
Weighted {
weights: Vec<f64>,
},
WeightedRrf {
k: usize,
weights: Vec<f64>,
},
Union,
VectorOnly,
KeywordOnly,
Custom {
name: String,
params: Value,
},
}Expand description
Validated selection for combining ranked result lists.
See crates/khive-fusion/docs/api/strategy-validation.md.
Variants§
Rrf
Reciprocal Rank Fusion (default, recommended). Rank-based, distribution-agnostic.
Weighted
Weighted linear combination of scores. Weights normalized to 1.0; must be finite.
WeightedRrf
Weighted Reciprocal Rank Fusion over ordered sources. Weights are not normalized.
Fields
Union
Take union with max score per ID.
VectorOnly
Skip BM25 entirely – return only vector (HNSW) results.
KeywordOnly
Skip HNSW entirely – return only BM25 keyword results.
Custom
Pack-defined or user-defined custom strategy dispatched by name at runtime.
Implementations§
Source§impl FusionStrategy
impl FusionStrategy
Sourcepub fn rrf() -> FusionStrategy
pub fn rrf() -> FusionStrategy
Create an RRF strategy with default k=60.
Sourcepub fn try_rrf(k: usize) -> Result<FusionStrategy, FusionStrategyError>
pub fn try_rrf(k: usize) -> Result<FusionStrategy, FusionStrategyError>
Create an RRF strategy, returning FusionStrategyError::RrfKZero for zero.
Sourcepub fn rrf_with_k(k: usize) -> FusionStrategy
pub fn rrf_with_k(k: usize) -> FusionStrategy
Create an RRF strategy, clamping k to at least 1.
Prefer try_rrf at public API boundaries.
Sourcepub fn try_weighted(
weights: Vec<f64>,
) -> Result<FusionStrategy, FusionStrategyError>
pub fn try_weighted( weights: Vec<f64>, ) -> Result<FusionStrategy, FusionStrategyError>
Create weighted fusion, returning an error for NaN or infinite weights.
Sourcepub fn weighted(weights: Vec<f64>) -> FusionStrategy
pub fn weighted(weights: Vec<f64>) -> FusionStrategy
Create a weighted strategy. Panics on NaN/infinity.
Prefer try_weighted at public API boundaries.
Sourcepub fn try_weighted_rrf(
k: usize,
weights: Vec<f64>,
) -> Result<FusionStrategy, FusionStrategyError>
pub fn try_weighted_rrf( k: usize, weights: Vec<f64>, ) -> Result<FusionStrategy, FusionStrategyError>
Create weighted reciprocal rank fusion, rejecting zero k and weights that are
non-finite or not strictly positive. Source-count validation happens when the strategy is
fused because a strategy does not carry its source lists.
Sourcepub fn weighted_rrf(k: usize, weights: Vec<f64>) -> FusionStrategy
pub fn weighted_rrf(k: usize, weights: Vec<f64>) -> FusionStrategy
Create weighted reciprocal rank fusion. Panics on zero k or invalid weights.
Prefer try_weighted_rrf at public API boundaries.
Sourcepub fn union() -> FusionStrategy
pub fn union() -> FusionStrategy
Create a union strategy.
Sourcepub fn try_custom(
name: String,
params: Value,
) -> Result<FusionStrategy, FusionStrategyError>
pub fn try_custom( name: String, params: Value, ) -> Result<FusionStrategy, FusionStrategyError>
Create a runtime-dispatched custom strategy, rejecting an empty name.
Trait Implementations§
Source§impl Clone for FusionStrategy
impl Clone for FusionStrategy
Source§fn clone(&self) -> FusionStrategy
fn clone(&self) -> FusionStrategy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FusionStrategy
impl Debug for FusionStrategy
Source§impl Default for FusionStrategy
impl Default for FusionStrategy
Source§fn default() -> FusionStrategy
fn default() -> FusionStrategy
Source§impl<'de> Deserialize<'de> for FusionStrategy
impl<'de> Deserialize<'de> for FusionStrategy
Source§fn deserialize<D>(
deserializer: D,
) -> Result<FusionStrategy, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<FusionStrategy, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl PartialEq for FusionStrategy
impl PartialEq for FusionStrategy
Source§impl Serialize for FusionStrategy
impl Serialize for FusionStrategy
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for FusionStrategy
Source§impl TryFrom<RawFusionStrategy> for FusionStrategy
impl TryFrom<RawFusionStrategy> for FusionStrategy
Source§type Error = FusionStrategyError
type Error = FusionStrategyError
Source§fn try_from(
raw: RawFusionStrategy,
) -> Result<FusionStrategy, <FusionStrategy as TryFrom<RawFusionStrategy>>::Error>
fn try_from( raw: RawFusionStrategy, ) -> Result<FusionStrategy, <FusionStrategy as TryFrom<RawFusionStrategy>>::Error>
Auto Trait Implementations§
impl Freeze for FusionStrategy
impl RefUnwindSafe for FusionStrategy
impl Send for FusionStrategy
impl Sync for FusionStrategy
impl Unpin for FusionStrategy
impl UnsafeUnpin for FusionStrategy
impl UnwindSafe for FusionStrategy
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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