pub enum MultiValueCombiner {
Sum,
Max,
Avg,
LogSumExp {
temperature: f32,
},
WeightedTopK {
k: usize,
decay: f32,
},
}Expand description
Strategy for combining scores when a document has multiple values for the same field
Variants§
Sum
Sum all scores (accumulates dot product contributions)
Max
Take the maximum score
Avg
Take the average score
LogSumExp
Softmax-weighted smooth maximum (default)
score = Σ softmax(t * sᵢ) * sᵢ
Higher temperature → closer to max; lower → closer to mean.
Deliberately NOT the raw (1/t)·log(Σ exp(t·sᵢ)): that form adds
ln(n)/t per document, so chunk count outranked chunk quality —
a 300-chunk compendium of mediocre matches beat every focused paper
(score 0.55 + ln(300)/1.5 ≈ 4.3 vs 0.72 + ln(3)/1.5 ≈ 1.4). The
softmax weighting is count-invariant (n identical scores combine to
that score), bounded by the max, and still tracks a dominant score
at any scale.
WeightedTopK
Weighted Top-K: weight top scores with exponential decay
score = Σ wᵢ * sorted_scores[i] where wᵢ = decay^i
Implementations§
Source§impl MultiValueCombiner
impl MultiValueCombiner
Sourcepub fn log_sum_exp() -> Self
pub fn log_sum_exp() -> Self
Create LogSumExp combiner with default temperature (1.5)
Sourcepub fn log_sum_exp_with_temperature(temperature: f32) -> Self
pub fn log_sum_exp_with_temperature(temperature: f32) -> Self
Create LogSumExp combiner with custom temperature
Sourcepub fn weighted_top_k() -> Self
pub fn weighted_top_k() -> Self
Create WeightedTopK combiner with defaults (k=5, decay=0.7)
Sourcepub fn weighted_top_k_with_params(k: usize, decay: f32) -> Self
pub fn weighted_top_k_with_params(k: usize, decay: f32) -> Self
Create WeightedTopK combiner with custom parameters
Trait Implementations§
Source§impl Clone for MultiValueCombiner
impl Clone for MultiValueCombiner
Source§fn clone(&self) -> MultiValueCombiner
fn clone(&self) -> MultiValueCombiner
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for MultiValueCombiner
Source§impl Debug for MultiValueCombiner
impl Debug for MultiValueCombiner
Source§impl Default for MultiValueCombiner
impl Default for MultiValueCombiner
Source§impl PartialEq for MultiValueCombiner
impl PartialEq for MultiValueCombiner
impl StructuralPartialEq for MultiValueCombiner
Auto Trait Implementations§
impl Freeze for MultiValueCombiner
impl RefUnwindSafe for MultiValueCombiner
impl Send for MultiValueCombiner
impl Sync for MultiValueCombiner
impl Unpin for MultiValueCombiner
impl UnsafeUnpin for MultiValueCombiner
impl UnwindSafe for MultiValueCombiner
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,
Source§impl<T> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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