Skip to main content

ListCursor

Struct ListCursor 

Source
pub struct ListCursor<'segment> { /* private fields */ }
Expand description

A decoding cursor over one (term, field) posting list.

Two scratch buffers are allocated when the cursor opens and reused for every block, so decode never allocates. Term frequencies are scaled by the field’s weight as they are decoded.

Implementations§

Source§

impl ListCursor<'_>

Source

pub fn reset(&mut self)

Rewinds to the first posting.

A cursor already sitting in block zero is rewound without decoding it again: a re-decode would charge the traversal for work it did not ask for, and blocks_decoded is a gated counter.

Source

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

Returns the document id at the cursor.

Source

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

Returns the unscaled term frequency at the cursor.

The first call against a block lazily decodes that block’s tf stream.

Source

pub fn current_weighted_tf(&mut self) -> Option<u64>

Returns the weight-scaled term frequency contribution at the cursor.

Scaled in u64 and left unrounded; the merge divides by 1,000 once, after summing, exactly as the in-memory merge did.

Source

pub fn advance(&mut self)

Advances one posting, loading the next block when the current ends.

Source

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

Advances to the first posting at or after row.

Skip keys ascend, so the first block that can hold row is a binary search over the metadata rows. Only the four skip-key bytes of each row are read while searching; nothing between here and the target is decoded, which is where block skipping actually pays.

Source

pub const fn exhausted(&self) -> bool

Returns true when the cursor has passed the last posting.

Source

pub const fn current_impact(&self) -> BlockImpact

Returns the impact pair of the block the cursor sits in.

Cached when the block was loaded; no metadata row is re-parsed.

Source

pub fn impact_for(&self, row: u32) -> Option<BlockImpact>

Returns the impact pair of the block that could contain row.

None when this run provably cannot contribute to row: the cursor has already advanced past it, or every remaining block ends below it. Only skip keys and one metadata row are read; nothing is decoded. This is what lets a traversal bound a candidate it has not paid to visit.

Source

pub const fn overall_impact(&self) -> BlockImpact

Returns the impact pair dominating every block of the list.

Computed once at seal; reading it costs nothing per query.

Trait Implementations§

Source§

impl<'segment> Clone for ListCursor<'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 ListCursor<'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 ListCursor<'segment>

§

impl<'segment> RefUnwindSafe for ListCursor<'segment>

§

impl<'segment> Send for ListCursor<'segment>

§

impl<'segment> Sync for ListCursor<'segment>

§

impl<'segment> Unpin for ListCursor<'segment>

§

impl<'segment> UnsafeUnpin for ListCursor<'segment>

§

impl<'segment> UnwindSafe for ListCursor<'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.