All Products
Document Center


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.

timeliness_ms: returns the timeliness score that indicates how new a document is




pubtime: the field whose timeliness is to be evaluated. The field must be of INT32 or INT64 type. Unit: milliseconds.

3.Return value:

The return value is of the FLOAT type. Valid values: [0,1]. A greater value indicates better timeliness. If the value of the field is later than the current time, 0 is returned.


Scenario 1: Use the create_timestamp field in a fine sort expression or the timeliness_ms(create_timestamp) function in a rough sort expression to calculate the timeliness score of a document.

5.Usage notes:

  • The pubtime field must be configured as an attribute field.

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