Skip to main content

RankedView

Struct RankedView 

Source
pub struct RankedView<'a> { /* private fields */ }
Expand description

A score-ordered, non-owning view of a PostingList.

Posting storage remains sorted by document id. The separate order by descending payload score is built lazily, with ascending document id as the deterministic tie-breaker. This lets support-preserving selections such as select_top_k(len) avoid ranking work entirely.

Implementations§

Source§

impl<'a> RankedView<'a>

Source

pub fn entries(&self) -> &[&'a PostingEntry]

Borrow every entry in rank order.

Source

pub fn top_k(&self, k: usize) -> &[&'a PostingEntry]

Borrow at most the first k entries in rank order.

Source

pub fn select_top_k(self, k: usize) -> PostingList

Materialize the top k selection as document-id-ordered posting storage.

Rank order intentionally does not leak into PostingList’s physical ordering invariant. If the view has not already been ranked, this uses linear-time selection rather than sorting entries that will immediately be reordered by document id. Use Self::top_k when rank order itself is needed.

Source

pub fn len(&self) -> usize

Number of ranked entries.

Source

pub fn is_empty(&self) -> bool

Whether the view contains no entries.

Source

pub fn iter( &self, ) -> impl ExactSizeIterator<Item = &'a PostingEntry> + DoubleEndedIterator + '_

Iterate in descending score order.

Trait Implementations§

Source§

impl<'a> Debug for RankedView<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !Freeze for RankedView<'a>

§

impl<'a> RefUnwindSafe for RankedView<'a>

§

impl<'a> Send for RankedView<'a>

§

impl<'a> Sync for RankedView<'a>

§

impl<'a> Unpin for RankedView<'a>

§

impl<'a> UnsafeUnpin for RankedView<'a>

§

impl<'a> UnwindSafe for RankedView<'a>

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.