All Products
Search
Document Center

:query_min_slide_window

Last Updated:Sep 09, 2021

Feature functions

You can use feature functions in sort expressions. Most feature functions can be used only in fine sort expressions. You can combine various syntax and clauses to perform complex sorts.

The fields that you reference in parameters of feature functions must be configured as index or attribute fields based on the description of each function.

query_min_slide_window: returns the ratio of the number of terms that are hit in a specific field to the minimum window of these terms in the field

1.Syntax:

query_min_slide_window(field_name, in_order=false)

2.Parameters:

field_name: the name of the field for which you want to collect statistics. The field must be of the TEXT or SHORT_TEXT type. The analyzer can be the general analyzer for Chinese, a custom analyzer, the single character analyzer for Chinese, an analyzer for English, or the fuzzy analyzer.

in_order: specifies whether the order of terms in a window must be consistent with that of the terms in a query when sliding window comparison is performed. Valid values: true and false. Default value: false.

3.Return value:

The return value is of the FLOAT type. Valid values: [0,1].

4.Scenarios:

Scenario 1: Use query_min_slide_window(title) to calculate the minimum window of query terms in the title field.

Scenario 2: Use if(query_min_slide_window(title, true) > 0.99, 1, 0) to determine whether the order of terms in the title field is the same as that of terms in the search query.

5.Usage notes:

  • The field that you reference in the parameter of this function must be configured as an index field.

  • You can use this feature function in fine sort expressions.

  • This function is used to measure the proximity of the query terms in the field_name field.

  • The following factors affect the calculation of sliding windows: the number of terms that are hit in the field_name field and the minimum window of these terms in the field.