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§
source§impl SuggestContextQuery
impl SuggestContextQuery
sourcepub fn new<T>(context: T) -> Selfwhere
T: ToString,
pub fn new<T>(context: T) -> Selfwhere T: ToString,
Creates an instance of SuggestContextQuery
context
- The value of the category to filter/boost on
sourcepub fn boost<T>(self, boost: T) -> Selfwhere
T: AsPrimitive<f32>,
pub fn boost<T>(self, boost: T) -> Selfwhere 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§
source§impl Clone for SuggestContextQuery
impl Clone for SuggestContextQuery
source§fn clone(&self) -> SuggestContextQuery
fn clone(&self) -> SuggestContextQuery
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SuggestContextQuery
impl Debug for SuggestContextQuery
source§impl IntoIterator for SuggestContextQuery
impl IntoIterator for SuggestContextQuery
§type Item = SuggestContextQuery
type Item = SuggestContextQuery
§type IntoIter = IntoIter<<SuggestContextQuery as IntoIterator>::Item>
type IntoIter = IntoIter<<SuggestContextQuery as IntoIterator>::Item>
source§impl PartialEq<SuggestContextQuery> for SuggestContextQuery
impl PartialEq<SuggestContextQuery> for SuggestContextQuery
source§fn eq(&self, other: &SuggestContextQuery) -> bool
fn eq(&self, other: &SuggestContextQuery) -> bool
self
and other
values to be equal, and is used
by ==
.