pub struct RoaringPostingList {
pub doc_ids: RoaringBitmap,
pub term_freqs: Vec<(u32, u32)>,
pub default_tf: u32,
pub max_tf: u32,
pub blocks: Vec<RoaringBlockInfo>,
pub max_score: f32,
}Expand description
Roaring bitmap with term frequencies for posting lists
Fields§
§doc_ids: RoaringBitmapDocument IDs as roaring bitmap
term_freqs: Vec<(u32, u32)>Term frequencies (sparse map for non-1 frequencies) Most terms have tf=1, so we only store exceptions
default_tf: u32Default term frequency (usually 1)
max_tf: u32Maximum term frequency
blocks: Vec<RoaringBlockInfo>Block metadata for BlockMax WAND (one per container)
max_score: f32Global maximum score across all blocks
Implementations§
Source§impl RoaringPostingList
impl RoaringPostingList
Sourcepub fn compute_bm25_upper_bound(max_tf: u32, idf: f32) -> f32
pub fn compute_bm25_upper_bound(max_tf: u32, idf: f32) -> f32
Compute BM25 upper bound score for a given max_tf and IDF
Sourcepub fn from_postings(doc_ids: &[u32], term_freqs: &[u32]) -> Self
pub fn from_postings(doc_ids: &[u32], term_freqs: &[u32]) -> Self
Create from doc_ids and term frequencies (without IDF - for backwards compatibility)
Sourcepub fn from_postings_with_idf(
doc_ids: &[u32],
term_freqs: &[u32],
idf: f32,
) -> Self
pub fn from_postings_with_idf( doc_ids: &[u32], term_freqs: &[u32], idf: f32, ) -> Self
Create from doc_ids and term frequencies with IDF for block-max scores
Sourcepub fn num_blocks(&self) -> usize
pub fn num_blocks(&self) -> usize
Get number of blocks (containers)
Sourcepub fn block_for_doc(&self, doc_id: u32) -> Option<usize>
pub fn block_for_doc(&self, doc_id: u32) -> Option<usize>
Get block index for a doc_id
Sourcepub fn deserialize<R: Read>(reader: &mut R) -> Result<Self>
pub fn deserialize<R: Read>(reader: &mut R) -> Result<Self>
Deserialize
Sourcepub fn iterator(&self) -> RoaringPostingIterator<'_>
pub fn iterator(&self) -> RoaringPostingIterator<'_>
Create iterator
Trait Implementations§
Source§impl Clone for RoaringPostingList
impl Clone for RoaringPostingList
Source§fn clone(&self) -> RoaringPostingList
fn clone(&self) -> RoaringPostingList
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RoaringPostingList
impl RefUnwindSafe for RoaringPostingList
impl Send for RoaringPostingList
impl Sync for RoaringPostingList
impl Unpin for RoaringPostingList
impl UnwindSafe for RoaringPostingList
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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