Struct elasticsearch_dsl::search::suggesters::SuggestContextQuery
source · [−]pub struct SuggestContextQuery { /* private fields */ }
Expand description
The completion suggester considers all documents in the index, but it is often desirable to serve suggestions filtered and/or boosted by some criteria. For example, you want to suggest song titles filtered by certain artists or you want to boost song titles based on their genre.
To achieve suggestion filtering and/or boosting, you can add context mappings while configuring
a completion field. You can define multiple context mappings for a completion field. Every
context mapping has a unique name and a type. There are two types: category
and geo
.
Context mappings are configured under the contexts parameter in the field mapping.
Implementations
sourceimpl SuggestContextQuery
impl SuggestContextQuery
sourcepub fn new<T>(context: T) -> Self where
T: ToString,
pub fn new<T>(context: T) -> Self where
T: ToString,
Creates an instance of SuggestContextQuery
context
- The value of the category to filter/boost on
sourcepub fn boost<T>(self, boost: T) -> Self where
T: AsPrimitive<f32>,
pub fn boost<T>(self, boost: T) -> Self where
T: AsPrimitive<f32>,
The factor by which the score of the suggestion should be boosted, the score is computed by
multiplying the boost with the suggestion weight, defaults to 1
Trait Implementations
sourceimpl Clone for SuggestContextQuery
impl Clone for SuggestContextQuery
sourcefn clone(&self) -> SuggestContextQuery
fn clone(&self) -> SuggestContextQuery
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for SuggestContextQuery
impl Debug for SuggestContextQuery
sourceimpl IntoIterator for SuggestContextQuery
impl IntoIterator for SuggestContextQuery
type Item = SuggestContextQuery
type Item = SuggestContextQuery
The type of the elements being iterated over.
type IntoIter = IntoIter<<SuggestContextQuery as IntoIterator>::Item>
type IntoIter = IntoIter<<SuggestContextQuery as IntoIterator>::Item>
Which kind of iterator are we turning this into?
sourceimpl PartialEq<SuggestContextQuery> for SuggestContextQuery
impl PartialEq<SuggestContextQuery> for SuggestContextQuery
sourcefn eq(&self, other: &SuggestContextQuery) -> bool
fn eq(&self, other: &SuggestContextQuery) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &SuggestContextQuery) -> bool
fn ne(&self, other: &SuggestContextQuery) -> bool
This method tests for !=
.
sourceimpl Serialize for SuggestContextQuery
impl Serialize for SuggestContextQuery
impl StructuralPartialEq for SuggestContextQuery
Auto Trait Implementations
impl RefUnwindSafe for SuggestContextQuery
impl Send for SuggestContextQuery
impl Sync for SuggestContextQuery
impl Unpin for SuggestContextQuery
impl UnwindSafe for SuggestContextQuery
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more