Skip to main content

PostingStore

Struct PostingStore 

Source
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>

Source

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.

Source

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.

Source

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.

Source

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).

Source

pub fn pool_bytes(&self) -> usize

Total bytes held by the two underlying pools.

Source

pub fn keys(&self) -> usize

Number of distinct keys.

Trait Implementations§

Source§

impl<'a, const TF: bool> Debug for PostingStore<'a, TF>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> 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.