pub struct TopK { /* private fields */ }Expand description
A bounded top-k heap with the pinned tie-break.
Ordering is descending score then ascending document id, matching
crate::fts::search exactly. The threshold this exposes is what every
pruning decision is made against.
Implementations§
Source§impl TopK
impl TopK
Sourcepub fn offer(&mut self, doc: GlobalDocId, score: f64)
pub fn offer(&mut self, doc: GlobalDocId, score: f64)
Offers one scored document.
Insertion into a sorted array, not a sort on every offer. For k of
order one hundred that is strictly less work, and it reproduces the
pinned tie-break exactly: the comparator is the same one, and the
scan stops at the first entry the newcomer does not precede, which is
where a stable sort would have placed it.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TopK
impl RefUnwindSafe for TopK
impl Send for TopK
impl Sync for TopK
impl Unpin for TopK
impl UnsafeUnpin for TopK
impl UnwindSafe for TopK
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more