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
sourceimpl 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
sourceimpl Clone for RankFeatureQuery
impl Clone for RankFeatureQuery
sourcefn clone(&self) -> RankFeatureQuery
fn clone(&self) -> RankFeatureQuery
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source. Read more