logo
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

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.

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.

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.

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.

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.

You can use named queries to track which queries matched returned documents. If named queries are used, the response includes a matched_queries property for each hit.

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html#named-queries

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.