All Products
Search
Document Center

:timeliness

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: returns the timeliness score that indicates how new a document is

1.Syntax:

timeliness(pubtime)

2.Parameters:

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

3.Return value:

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

4.Scenarios:

Scenario 1: Use the create_timestamp field in a fine sort expression or the timeliness(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.