Skip to main content

TermCursor

Struct TermCursor 

Source
pub struct TermCursor<'segment> {
    pub stream: TermStream<'segment>,
    pub df: Df,
    pub scorer: TermScorer,
    pub upper_bound: f64,
}
Expand description

One query term prepared for pruning within one segment.

The cursor is a view over the sealed streams, not a copy of them. It holds no entry array: advance and seek walk block metadata and decode only the blocks the traversal actually lands in.

Fields§

§stream: TermStream<'segment>

The merged sealed postings for this term across the weighted fields.

§df: Df

Store-wide document frequency.

§scorer: TermScorer

This term’s hoisted scoring constants.

Built once per (term, segment) so the inner loops never recompute idf or avgdl. See crate::fts::bm25::TermScorer.

§upper_bound: f64

Largest contribution this term can make to any document.

Implementations§

Source§

impl TermCursor<'_>

Source

pub fn current(&self) -> Option<u32>

Returns the row at the cursor, or None when exhausted.

Source

pub fn current_tf(&mut self) -> Option<u32>

Returns the merged term frequency at the cursor.

The first ask against a block pays that block’s tf decode; rows that are skipped rather than scored never pay it.

Source

pub fn advance(&mut self)

Advances one merged posting.

Source

pub fn reset(&mut self)

Rewinds to the first merged posting.

Source

pub fn seek(&mut self, row: u32)

Advances to the first row at or after row.

Skip keys ascend, so the first block that can hold row is a binary search over metadata rows; the blocks between are never decoded.

Source

pub fn current_block_max(&self) -> f64

Returns the bound of the block the cursor currently sits in.

Read from the stored impact pairs and evaluated against this query’s live statistics; see crate::fts::sealed.

Source

pub fn exhausted(&self) -> bool

Returns true when the cursor has passed the last entry.

Trait Implementations§

Source§

impl<'segment> Clone for TermCursor<'segment>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'segment> Debug for TermCursor<'segment>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'segment> Freeze for TermCursor<'segment>

§

impl<'segment> RefUnwindSafe for TermCursor<'segment>

§

impl<'segment> Send for TermCursor<'segment>

§

impl<'segment> Sync for TermCursor<'segment>

§

impl<'segment> Unpin for TermCursor<'segment>

§

impl<'segment> UnsafeUnpin for TermCursor<'segment>

§

impl<'segment> UnwindSafe for TermCursor<'segment>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.