pub struct CorpusStats { /* private fields */ }Expand description
Store-wide corpus statistics.
crate::fts::index::LexicalIndex derives these store-wide values from
all of its sealed segments. Scoring never substitutes per-segment corpus
statistics.
Implementations§
Source§impl CorpusStats
impl CorpusStats
Sourcepub const fn new(doc_count: u64, total_tokens: u64) -> Result<Self, Bm25Error>
pub const fn new(doc_count: u64, total_tokens: u64) -> Result<Self, Bm25Error>
Builds validated statistics.
§Errors
Returns Bm25Error::EmptyCorpus or Bm25Error::NoTokens when
avgdl would be undefined. An empty corpus is not scored; it is
refused, because a silent avgdl of zero produces infinities.
Sourcepub const fn document_count(&self) -> u64
pub const fn document_count(&self) -> u64
Returns the store-wide document count, N.
Sourcepub const fn total_tokens(&self) -> u64
pub const fn total_tokens(&self) -> u64
Returns the store-wide analyzed token count.
Sourcepub fn average_document_length(&self) -> f64
pub fn average_document_length(&self) -> f64
Returns avgdl, counted in tokens after analysis.
The unit matters: avgdl must be counted over the same unit being
scored, in analyzed tokens, never in raw bytes or pre-analysis words.
Trait Implementations§
Source§impl Clone for CorpusStats
impl Clone for CorpusStats
impl Copy for CorpusStats
Source§impl Debug for CorpusStats
impl Debug for CorpusStats
impl Eq for CorpusStats
Source§impl PartialEq for CorpusStats
impl PartialEq for CorpusStats
impl StructuralPartialEq for CorpusStats
Auto Trait Implementations§
impl Freeze for CorpusStats
impl RefUnwindSafe for CorpusStats
impl Send for CorpusStats
impl Sync for CorpusStats
impl Unpin for CorpusStats
impl UnsafeUnpin for CorpusStats
impl UnwindSafe for CorpusStats
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