pub struct BoolQuery { /* private fields */ }Expand description
Clauses combined.
The four slots differ in two ways that are easy to confuse:
mustandshouldaffect the score;filterandmust_notdo not, and are cached, so anything that is a yes-or-no test belongs infilter.must,filterandmust_notare requirements.shouldis one only when nothing else in the query is — otherwise it merely raises the score of documents that match it.BoolQuery::minimum_should_matchis what turns it back into a requirement, andQuery::any_ofdoes that for you.
Implementations§
Source§impl BoolQuery
impl BoolQuery
Sourcepub fn must(self, query: impl Into<Query>) -> BoolQuery
pub fn must(self, query: impl Into<Query>) -> BoolQuery
Required, and contributes to the score.
Sourcepub fn should(self, query: impl Into<Query>) -> BoolQuery
pub fn should(self, query: impl Into<Query>) -> BoolQuery
Optional, and raises the score of documents that match — unless
BoolQuery::minimum_should_match makes it a requirement.
Sourcepub fn must_not(self, query: impl Into<Query>) -> BoolQuery
pub fn must_not(self, query: impl Into<Query>) -> BoolQuery
Must not match. Does not affect the score.
Sourcepub fn filter(self, query: impl Into<Query>) -> BoolQuery
pub fn filter(self, query: impl Into<Query>) -> BoolQuery
Required, but contributes nothing to the score and is cached.
The right slot for a status, an owner, a date window — anything where the answer is yes or no rather than “how well”.
Sourcepub fn minimum_should_match(self, value: impl Into<Json>) -> BoolQuery
pub fn minimum_should_match(self, value: impl Into<Json>) -> BoolQuery
How many of the should clauses have to match: a count, a negative
count, or a percentage like "50%".
Trait Implementations§
impl StructuralPartialEq for BoolQuery
Auto Trait Implementations§
impl Freeze for BoolQuery
impl RefUnwindSafe for BoolQuery
impl Send for BoolQuery
impl Sync for BoolQuery
impl Unpin for BoolQuery
impl UnsafeUnpin for BoolQuery
impl UnwindSafe for BoolQuery
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