Skip to main content

BlockImpact

Struct BlockImpact 

Source
pub struct BlockImpact {
    pub max_tf: u32,
    pub min_len: u16,
}
Expand description

One block’s impact pair: the two extremes that bound every posting in it.

§Why a pair and not a stored score

A stored score is a number computed under one set of statistics. BM25’s score / ceiling is tf / (tf + k1 * (1 - b + b * len / avgdl)), so idf cancels but avgdl and (k1, b) do not: a bound sealed when documents were short falls below a true score once avgdl rises, and a bound sealed under beir() falls below one read under anserini(). Measured shortfalls were 15.21% and 19.56%.

A pair carries no statistics at all. term_score is monotone increasing in tf and monotone decreasing in len, so evaluating it at the block’s largest tf and shortest document dominates every posting in the block under ANY statistics and ANY (k1, b). The two extremes need not come from the same document; pairing them is looser than the true maximum and is therefore still an upper bound.

Fields§

§max_tf: u32

Largest term frequency in the block.

§min_len: u16

Smallest document length in the block, saturating DOWN.

Implementations§

Source§

impl BlockImpact

Source

pub const fn from_meta(meta: &BlockMeta) -> Self

Reads the pair out of a persisted metadata row.

Source

pub const fn is_absent(&self) -> bool

Returns true when the pair bounds nothing.

A real block has at least one posting, whose term frequency is at least one, so a zero max_tf can only mean the pair was never written — a version 1 stream, or a v2 stream missing an entry.

Source

pub fn bound(&self, scorer: &TermScorer) -> f64

Evaluates the bound under the caller’s live scoring constants.

This is the whole remedy: the bound is computed HERE, at query time, from statistics that are current and parameters the caller chose.

Trait Implementations§

Source§

impl Clone for BlockImpact

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for BlockImpact

Source§

impl Debug for BlockImpact

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BlockImpact

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for BlockImpact

Source§

impl PartialEq for BlockImpact

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BlockImpact

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.