All Products
Search
Document Center

:field_term_match_count

Last Updated:Sep 09, 2021

Feature function

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 statements to conduct complex sorts.

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

field_term_match_count: returns the number of terms that match the search query in a field

1.Syntax:

field_term_match_count(field_name)

2.Parameter:

field_name: the name of the field for which you want to collect statistics. The field must be of the 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.

3.Return value:

int

4.Scenario:

Scenario 1

Process the results based on the number of terms that match the search query in the field.

if (field_term_match_count(title) > 5, 0.8, 0.6)

5.Note:

  • 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.

  • All terms in the search query that hit documents are counted. Repeated terms are counted each time they hit documents.