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 more