Struct elasticsearch_dsl::search::queries::specialized::RankFeatureQuery
source · pub struct RankFeatureQuery { /* private fields */ }Expand description
Boosts the relevance score of documents based on the numeric value of a rank_feature or
rank_features field.
To create a rank feature query:
Query::rank_feature("test");To apply mathematical functions:
Query::rank_feature("test").saturation();
Query::rank_feature("test").saturation().pivot(2.2);
Query::rank_feature("test").logarithm(3.0);
Query::rank_feature("test").sigmoid(1.0, 2.0);
Query::rank_feature("test").linear();https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-rank-feature-query.html
Implementations§
source§impl RankFeatureQuery
impl RankFeatureQuery
pub fn serialize<__S>(
__self: &RankFeatureQuery,
__serializer: __S,
) -> Result<__S::Ok, __S::Error>where
__S: Serializer,
source§impl RankFeatureQuery
impl RankFeatureQuery
sourcepub fn saturation(self) -> RankFeatureSaturationQuery
pub fn saturation(self) -> RankFeatureSaturationQuery
The saturation function gives a score equal to S / (S + pivot), where S is the value
of the rank feature field and pivot is a configurable pivot value so that the result will
be less than 0.5 if S is less than pivot and greater than 0.5 otherwise.
Scores are always (0,1).
If the rank feature has a negative score impact then the function will be computed as
pivot / (S + pivot), which decreases when S increases.
If a pivot value is not provided, Elasticsearch computes a default value equal to the
approximate geometric mean of all rank feature values in the index. We recommend using this
default value if you haven’t had the opportunity to train a good pivot value.
sourcepub fn logarithm(self, scaling_factor: f64) -> RankFeatureLogarithmQuery
pub fn logarithm(self, scaling_factor: f64) -> RankFeatureLogarithmQuery
The log function gives a score equal to log(scaling_factor + S), where S is the value
of the rank feature field and scaling_factor is a configurable scaling factor.
Scores are unbounded.
This function only supports rank features that have a positive score impact.
sourcepub fn sigmoid(self, pivot: f64, exponent: f64) -> RankFeatureSigmoidQuery
pub fn sigmoid(self, pivot: f64, exponent: f64) -> RankFeatureSigmoidQuery
The sigmoid function is an extension of saturation which adds a configurable exponent.
Scores are computed as S^exp^ / (S^exp^ + pivot^exp^). Like for the saturation function,
pivot is the value of S that gives a score of 0.5 and scores are (0,1).
The exponent must be positive and is typically in [0.5, 1]. A good value should be
computed via training. If you don’t have the opportunity to do so, we recommend you use the
saturation function instead.
sourcepub fn linear(self) -> RankFeatureLinearQuery
pub fn linear(self) -> RankFeatureLinearQuery
The linear function is the simplest function, and gives a score equal to the indexed
value of S, where S is the value of the rank feature field. If a rank feature field is
indexed with "positive_score_impact": true, its indexed value is equal to S and rounded
to preserve only 9 significant bits for the precision. If a rank feature field is indexed
with "positive_score_impact": false, its indexed value is equal to 1/S and rounded to
preserve only 9 significant bits for the precision.
sourcepub fn boost<T>(self, boost: T) -> Selfwhere
T: AsPrimitive<f32>,
pub fn boost<T>(self, boost: T) -> Selfwhere
T: AsPrimitive<f32>,
Floating point number used to decrease or increase the
relevance scores
of a query. Defaults to 1.0.
You can use the boost parameter to adjust relevance scores for searches containing two or more queries.
Boost values are relative to the default value of 1.0.
A boost value between 0 and 1.0 decreases the relevance score.
A value greater than 1.0 increases the relevance score.
Trait Implementations§
source§impl Clone for RankFeatureQuery
impl Clone for RankFeatureQuery
source§fn clone(&self) -> RankFeatureQuery
fn clone(&self) -> RankFeatureQuery
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for RankFeatureQuery
impl Debug for RankFeatureQuery
source§impl From<RankFeatureQuery> for Option<Query>
impl From<RankFeatureQuery> for Option<Query>
source§fn from(q: RankFeatureQuery) -> Self
fn from(q: RankFeatureQuery) -> Self
source§impl From<RankFeatureQuery> for Query
impl From<RankFeatureQuery> for Query
source§fn from(q: RankFeatureQuery) -> Self
fn from(q: RankFeatureQuery) -> Self
source§impl IntoIterator for RankFeatureQuery
impl IntoIterator for RankFeatureQuery
§type Item = RankFeatureQuery
type Item = RankFeatureQuery
§type IntoIter = IntoIter<<RankFeatureQuery as IntoIterator>::Item>
type IntoIter = IntoIter<<RankFeatureQuery as IntoIterator>::Item>
source§impl PartialEq<Query> for RankFeatureQuery
impl PartialEq<Query> for RankFeatureQuery
source§impl PartialEq<RankFeatureQuery> for Query
impl PartialEq<RankFeatureQuery> for Query
source§impl PartialEq for RankFeatureQuery
impl PartialEq for RankFeatureQuery
source§impl Serialize for RankFeatureQuery
impl Serialize for RankFeatureQuery
impl StructuralPartialEq for RankFeatureQuery
Auto Trait Implementations§
impl Freeze for RankFeatureQuery
impl RefUnwindSafe for RankFeatureQuery
impl Send for RankFeatureQuery
impl Sync for RankFeatureQuery
impl Unpin for RankFeatureQuery
impl UnwindSafe for RankFeatureQuery
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)