pub trait TwoPhaseIterator: Send {
// Required methods
fn matches(&mut self) -> bool;
fn match_cost(&self) -> f32;
}Expand description
Two-phase verification for approximate scorers.
Used by phrase queries, geo distance queries, regex queries, and other scorers where the fast approximation (posting list intersection) produces a superset of true matches and each candidate needs expensive verification. See [[architecture-query-execution#Core Traits]].
Required Methods§
Sourcefn matches(&mut self) -> bool
fn matches(&mut self) -> bool
Verify that the current document (from the parent Scorer) truly
matches. Called after the scorer’s next()/advance() positions on
a candidate.
Sourcefn match_cost(&self) -> f32
fn match_cost(&self) -> f32
Estimated cost of a single matches() call, relative to the cost
of advance(). Used to order multiple two-phase scorers
cheapest-first in conjunctions.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".