Feature Function Term
You can use feature functions in sort expressions to create powerful sorting features. Most feature functions are supported only in fine sort expressions, where you can combine various syntaxes and statements to customize the sorting logic.
Create an index for any document field that you use as a function parameter.
field_match_ratio: Calculates the ratio of matching token groups to total token groups in a field
1. Usage details:
field_match_ratio(field_name, index_name)
2. Parameters
field_name: The name of the field for which you want to calculate the ratio. This field must be of the TEXT or SHORT_TEXT type and configured with one of the following analyzers: Chinese basic tokenization, custom tokenization, single-word tokenization, English tokenization, or fuzzy analysis.
index_name: The name of the index that corresponds to field_name. This parameter is optional.
3. Return value
Returns a float value in the range of [0, 1].
4. Scenarios
Scenario 1:
Calculate the degree to which the title and body fields match the search query in the fine sort stage.
field_match_ratio(title)*10 + field_match_ratio(body)5. Notes
Create an index of the appropriate type for any field used as a function parameter.
This function can be used in fine sort expressions.
This feature function indicates how well a field matches the search query.