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>
impl<'a> RankedView<'a>
Sourcepub fn entries(&self) -> &[&'a PostingEntry]
pub fn entries(&self) -> &[&'a PostingEntry]
Borrow every entry in rank order.
Sourcepub fn top_k(&self, k: usize) -> &[&'a PostingEntry]
pub fn top_k(&self, k: usize) -> &[&'a PostingEntry]
Borrow at most the first k entries in rank order.
Sourcepub fn select_top_k(self, k: usize) -> PostingList
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.
Sourcepub fn iter(
&self,
) -> impl ExactSizeIterator<Item = &'a PostingEntry> + DoubleEndedIterator + '_
pub fn iter( &self, ) -> impl ExactSizeIterator<Item = &'a PostingEntry> + DoubleEndedIterator + '_
Iterate in descending score order.