pub struct Postings { /* private fields */ }Expand description
Inverted index: trigram_hash -> bitmap of doc ids.
Implementations§
Source§impl Postings
impl Postings
Sourcepub fn insert(&mut self, trigram: u64, doc_id: u32)
pub fn insert(&mut self, trigram: u64, doc_id: u32)
Insert doc_id into the postings list for trigram.
Idempotent: re-inserting the same (trigram, doc_id)
pair is a no-op.
Sourcepub fn remove(&mut self, trigram: u64, doc_id: u32)
pub fn remove(&mut self, trigram: u64, doc_id: u32)
Remove doc_id from the postings list for trigram.
If removing leaves the postings list empty, the trigram entry is dropped from the map (garbage collection).
Sourcepub fn lookup(&self, trigram: u64) -> Option<&RoaringBitmap>
pub fn lookup(&self, trigram: u64) -> Option<&RoaringBitmap>
Borrow the postings bitmap for trigram, if any.
Sourcepub fn intersect(&self, trigrams: &[u64]) -> RoaringBitmap
pub fn intersect(&self, trigrams: &[u64]) -> RoaringBitmap
Intersect the postings lists for the given trigrams.
Returns the set of doc ids that appear in EVERY trigram’s
list. If trigrams is empty, the result is empty (the
index does not invent a “universal” set: callers asking
to intersect “no” trigrams should treat this as a
no-evidence query and either fall back to a full scan or
return the empty set, depending on policy).
If any trigram has no postings entry, the result is empty (a missing trigram is provably absent from every doc).
The reduction order is by ascending posting-list size so the working set shrinks as fast as possible.
Sourcepub fn union(&self, trigrams: &[u64]) -> RoaringBitmap
pub fn union(&self, trigrams: &[u64]) -> RoaringBitmap
Union the postings lists for the given trigrams.
Returns the set of doc ids that appear in AT LEAST ONE of the trigrams’ lists. Missing trigrams contribute nothing. An empty input yields the empty set.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Postings
impl<'de> Deserialize<'de> for Postings
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Postings
impl RefUnwindSafe for Postings
impl Send for Postings
impl Sync for Postings
impl Unpin for Postings
impl UnsafeUnpin for Postings
impl UnwindSafe for Postings
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
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>
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