pub struct SharedThreshold { /* private fields */ }Expand description
Cross-segment top-k score floor, shared across the parallel/concurrent per-segment searches of a single query.
Stores an f32 as raw bits in an atomic so it can be read and monotonically
raised from many threads without a lock. Each segment reads the current
floor as its initial pruning threshold (ScorerOptions::initial_threshold)
and, once it has collected a full top-k of its own, raises the floor to
its k-th score.
Safety of seeding: a segment only raises the floor after filling its own
heap, so a floor value v is always backed by at least k real documents
scoring >= v. The final merged k-th score is therefore >= v, and seeding
any other segment with v can never drop a document that belongs in the
final top-k. Completion order is arbitrary, so the floor is best-effort — it
only changes how aggressively later segments prune, never correctness.
The floor carries the query’s result-window depth k (for_limit).
Publishing from a heap shallower than k is invalid — a segment with
fewer documents than the window fills its clamped heap early, and its
heap threshold says nothing about the query-global k-th score. Executors
must check SharedThreshold::covers before raising the floor with a
full-heap threshold.
Implementations§
Sourcepub fn new() -> Self
pub fn new() -> Self
A fresh floor of 0.0 (no pruning seed) with an unknown window depth. Executors can read and manually raise it, but never publish their own full-heap thresholds into it.
Sourcepub fn with_deadline(self, deadline: Option<Instant>) -> Self
pub fn with_deadline(self, deadline: Option<Instant>) -> Self
Attach a wall-clock budget (None = unbounded).
Sourcepub fn mark_truncated(&self)
pub fn mark_truncated(&self)
Record that an executor stopped early because the deadline passed.
Trait Implementations§
Source§fn clone(&self) -> SharedThreshold
fn clone(&self) -> SharedThreshold
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more