pub struct BooleanQuery {
pub must: Vec<Arc<dyn Query>>,
pub should: Vec<Arc<dyn Query>>,
pub must_not: Vec<Arc<dyn Query>>,
/* private fields */
}Expand description
Boolean query with MUST, SHOULD, and MUST_NOT clauses
When all clauses are SHOULD term queries on the same field, automatically uses MaxScore optimization for efficient top-k retrieval.
Fields§
§must: Vec<Arc<dyn Query>>§should: Vec<Arc<dyn Query>>§must_not: Vec<Arc<dyn Query>>Implementations§
Source§impl BooleanQuery
impl BooleanQuery
pub fn new() -> Self
pub fn must(self, query: impl Query + 'static) -> Self
pub fn should(self, query: impl Query + 'static) -> Self
pub fn must_not(self, query: impl Query + 'static) -> Self
Sourcepub fn with_global_stats(self, stats: Arc<GlobalStats>) -> Self
pub fn with_global_stats(self, stats: Arc<GlobalStats>) -> Self
Set global statistics for cross-segment IDF
Sourcepub fn with_proximity(self, config: ProximityConfig) -> Self
pub fn with_proximity(self, config: ProximityConfig) -> Self
Rescore the text MaxScore top candidates with term proximity
(docs: query::proximity). Applies when the SHOULD clauses are text
terms of one field, in query order.
Sourcepub fn with_text_heap_factor(self, heap_factor: f32) -> Self
pub fn with_text_heap_factor(self, heap_factor: f32) -> Self
Approximate text MaxScore (threshold / heap_factor), like sparse.
1 is exact; [0, 1) prunes more aggressively, with an effective 0.01
floor. Non-finite values and values outside [0, 1] fail construction
of the scorer. RPC zero/unset is normalized to 1 by the adapter.
Sourcepub fn with_max_terms(self, max_terms: usize) -> Self
pub fn with_max_terms(self, max_terms: usize) -> Self
Cap the text terms scored per field group to the max_terms rarest
(highest idf) ones; 0 = no cap.
Trait Implementations§
Source§impl Clone for BooleanQuery
impl Clone for BooleanQuery
Source§fn clone(&self) -> BooleanQuery
fn clone(&self) -> BooleanQuery
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BooleanQuery
impl Debug for BooleanQuery
Source§impl Default for BooleanQuery
impl Default for BooleanQuery
Source§impl Display for BooleanQuery
impl Display for BooleanQuery
Source§impl Query for BooleanQuery
impl Query for BooleanQuery
Source§fn scorer<'a>(
&self,
reader: &'a SegmentReader,
limit: usize,
) -> ScorerFuture<'a>
fn scorer<'a>( &self, reader: &'a SegmentReader, limit: usize, ) -> ScorerFuture<'a>
Source§fn scorer_with_options<'a>(
&self,
reader: &'a SegmentReader,
limit: usize,
options: ScorerOptions,
) -> ScorerFuture<'a>
fn scorer_with_options<'a>( &self, reader: &'a SegmentReader, limit: usize, options: ScorerOptions, ) -> ScorerFuture<'a>
Source§fn scorer_sync<'a>(
&self,
reader: &'a SegmentReader,
limit: usize,
) -> Result<Box<dyn Scorer + 'a>>
fn scorer_sync<'a>( &self, reader: &'a SegmentReader, limit: usize, ) -> Result<Box<dyn Scorer + 'a>>
Source§fn scorer_sync_with_options<'a>(
&self,
reader: &'a SegmentReader,
limit: usize,
options: ScorerOptions,
) -> Result<Box<dyn Scorer + 'a>>
fn scorer_sync_with_options<'a>( &self, reader: &'a SegmentReader, limit: usize, options: ScorerOptions, ) -> Result<Box<dyn Scorer + 'a>>
Query::scorer_with_options.Source§fn text_terms(&self, out: &mut Vec<(Field, Vec<u8>)>)
fn text_terms(&self, out: &mut Vec<(Field, Vec<u8>)>)
(field, term) this query scores with BM25 to
out. The searcher aggregates their document frequencies
across segments before scoring (see ScorerOptions::global_stats).Source§fn decompose(&self) -> QueryDecomposition
fn decompose(&self) -> QueryDecomposition
Source§fn should_children(&self) -> Option<&[Arc<dyn Query>]>
fn should_children(&self) -> Option<&[Arc<dyn Query>]>
Source§fn as_doc_bitset(&self, reader: &SegmentReader) -> Option<DocBitset>
fn as_doc_bitset(&self, reader: &SegmentReader) -> Option<DocBitset>
Source§fn as_doc_bitset_with_options(
&self,
reader: &SegmentReader,
options: &ScorerOptions,
) -> Option<DocBitset>
fn as_doc_bitset_with_options( &self, reader: &SegmentReader, options: &ScorerOptions, ) -> Option<DocBitset>
None means unsupported or
cancelled; cancellation must flag the shared budget, and a
partial bitset must never escape as a complete filter.Source§fn as_doc_predicate<'a>(
&self,
reader: &'a SegmentReader,
) -> Option<DocPredicate<'a>>
fn as_doc_predicate<'a>( &self, reader: &'a SegmentReader, ) -> Option<DocPredicate<'a>>
Source§fn count_estimate<'a>(&self, reader: &'a SegmentReader) -> CountFuture<'a>
fn count_estimate<'a>(&self, reader: &'a SegmentReader) -> CountFuture<'a>
Source§fn is_filter(&self) -> bool
fn is_filter(&self) -> bool
Source§fn bitset_cardinality_estimate(&self, _reader: &SegmentReader) -> Option<u64>
fn bitset_cardinality_estimate(&self, _reader: &SegmentReader) -> Option<u64>
None = unknown (treated as matching everything).Auto Trait Implementations§
impl !RefUnwindSafe for BooleanQuery
impl !UnwindSafe for BooleanQuery
impl Freeze for BooleanQuery
impl Send for BooleanQuery
impl Sync for BooleanQuery
impl Unpin for BooleanQuery
impl UnsafeUnpin for BooleanQuery
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<E> ResultError for E
impl<T> ResultType for T
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more