Skip to main content

TextSegment

Struct TextSegment 

Source
pub struct TextSegment { /* private fields */ }
Expand description

One shard’s inverted segment.

postings maps token → (key → tf) so a pruned list is PROBED per accumulated candidate (O(candidates)) instead of walked (O(postings)); docs keeps each row’s original text so an update removes exactly its own tokens (re-tokenize the old text) instead of scanning every posting list.

Implementations§

Source§

impl TextSegment

Source

pub fn new() -> Self

Empty segment.

Source

pub fn apply(&mut self, key: &[u8], text: Option<&[u8]>)

(Re-)index one row’s text (None = row removed / excluded).

Source

pub fn matches(&self, query: &[u8], limit: usize) -> Vec<TextMatch>

BM25-ranked matches for query (tokenized with the same rules; OR semantics), best limit hits, score-descending.

MaxScore pruning: query tokens process rarest-first; once the running top-limit threshold exceeds the summed upper bounds of the remaining (commoner) tokens, documents seen ONLY in those lists can no longer enter — their lists are then probed per accumulated doc instead of walked. Selection is a bounded heap over borrowed keys (no per-candidate allocation).

Source

pub fn stats(&self) -> TextStats

Live counters.

Source

pub fn contains(&self, key: &[u8]) -> bool

Verify hook: is key indexed here?

Trait Implementations§

Source§

impl Debug for TextSegment

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for TextSegment

Source§

fn default() -> TextSegment

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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.