pub struct PostingStore<'a, const TF: bool> { /* private fields */ }Expand description
Key → sorted id list storage; TF adds a one-byte term frequency to
every entry (the BM25 flavor).
Implementations§
Source§impl<'a, const TF: bool> PostingStore<'a, TF>
impl<'a, const TF: bool> PostingStore<'a, TF>
Sourcepub fn new(shards: usize, max_bytes: usize) -> Result<Self, Error>
pub fn new(shards: usize, max_bytes: usize) -> Result<Self, Error>
Creates an empty store. shards follows the owning index’s config
(power of two); max_bytes bounds the chunk pool.
Sourcepub fn push(&mut self, raw_key: u32, id: FactId, tf: u8) -> Result<(), Error>
pub fn push(&mut self, raw_key: u32, id: FactId, tf: u8) -> Result<(), Error>
Appends (id, tf) to key’s list. Ids must arrive in strictly
ascending order per key — the caller indexes facts in id order, so
a violation is a caller bug and panics (debug) / corrupts the one
list (release), never the store.
§Errors
Error::Arena when a pool hits its byte ceiling.
Sourcepub fn count(&self, raw_key: u32) -> u32
pub fn count(&self, raw_key: u32) -> u32
Number of entries in key’s list (0 when absent). This is the
document frequency for BM25 keys.
Sourcepub fn entries(&self, raw_key: u32) -> Entries<'_, TF> ⓘ
pub fn entries(&self, raw_key: u32) -> Entries<'_, TF> ⓘ
Iterates key’s list as (id, tf) pairs in ascending id order
(tf is 1 for TF = false stores).
Sourcepub fn pool_bytes(&self) -> usize
pub fn pool_bytes(&self) -> usize
Total bytes held by the two underlying pools.
Trait Implementations§
Auto Trait Implementations§
impl<'a, const TF: bool> Freeze for PostingStore<'a, TF>
impl<'a, const TF: bool> RefUnwindSafe for PostingStore<'a, TF>
impl<'a, const TF: bool> Send for PostingStore<'a, TF>
impl<'a, const TF: bool> Sync for PostingStore<'a, TF>
impl<'a, const TF: bool> Unpin for PostingStore<'a, TF>
impl<'a, const TF: bool> UnsafeUnpin for PostingStore<'a, TF>
impl<'a, const TF: bool> UnwindSafe for PostingStore<'a, TF>
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