Skip to main content

CorpusStats

Struct CorpusStats 

Source
pub struct CorpusStats {
    pub n_docs: f64,
    pub avgdl: f64,
    pub df: HashMap<Vec<u8>, u32>,
}
Expand description

Corpus statistics supplied from outside a segment, for scoring one shard’s documents against the whole corpus rather than its own slice.

A cross-shard text query builds this by summing each shard’s local n_docs / total_len and, for each query token, its df. df need only carry the query’s tokens — the values a query actually scores with — which is why global BM25 does not need a whole-corpus df table.

Fields§

§n_docs: f64

Total documents across the corpus.

§avgdl: f64

Mean document length (unweighted tokens) across the corpus.

§df: HashMap<Vec<u8>, u32>

Global document frequency per query token; a token missing here falls back to the segment’s local list length.

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.