Ranking signal supported operations
Index Version Requirements: v2.0.0+
List of operations supported in the ranking_expr="<your-expression>"
syntax.
The explanation on how to use ranking signals is available here.
Search
Operation | Type | Description / Examples |
---|---|---|
uncalibrated_relevance | Float | the unmodified relevance score of the object |
object.<property> | Any | the value of <property> for the object as defined in the object store. Nested fields can be accessed with the dot notation e.g. object.a.b.c |
NOW | Float | the current timestamp in unix time (seconds) |
timestamp(<timestamp>) | Float | function to convert a RFC 3339 <timestamp> |
Important: The relevance is "uncalibrated" and is only meant to compare objects. The value does not have an intrinsic meaning; its distribution and bounds can vary depending on the evaluation method. We advise against using its value as a cutoff.
Operators
Operator | Description |
---|---|
^ | Exponentiation |
* | Product |
/ | Division (integer if both arguments are integers, otherwise float) |
% | Modulo (integer if both arguments are integers, otherwise float) |
+ | Sum or String Concatenation |
- | Difference |
< | Lower than |
> | Greater than |
<= | Lower than or equal |
>= | Greater than or equal |
== | Equal |
!= | Not equal |
&& | Logical and |
|| | Logical or |
- | Negation |
! | Logical not |
, | Aggregation |
; | Expression Chaining |
Operators: Variables and Assignment
Operator | Description |
---|---|
= | Assignment |
+= | Sum-Assignment or String-Concatenation-Assignment |
-= | Difference-Assignment |
*= | Product-Assignment |
/= | Division-Assignment |
%= | Modulo-Assignment |
^= | Exponentiation-Assignment |
&&= | Logical-And-Assignment |
||= | Logical-Or-Assignment |
Value Types
Value type | Example |
---|---|
String | "abc" , "" , "a\"b\\c" |
Boolean | true , false |
Int | 3 , -9 , 0 , 135412 , 0xfe02 , -0x1e |
Float | 3. , .35 , 1.00 , 0.5 , 123.554 , 23e4 , -2e-3 , 3.54e+2 |
Tuple | (3, 55.0, false, ()) , (1, 2) |
Empty | () |
Common Functions
Identifier | Argument Amount | Argument Types | Description |
---|---|---|---|
min | >= 1 | Numeric | Returns the minimum of the arguments |
max | >= 1 | Numeric | Returns the maximum of the arguments |
len | 1 | String/Tuple | Returns the character length of a string, or the amount of elements in a tuple (not recursively) |
floor | 1 | Numeric | Returns the largest integer less than or equal to a number |
round | 1 | Numeric | Returns the nearest integer to a number. Rounds half-way cases away from 0.0 |
ceil | 1 | Numeric | Returns the smallest integer greater than or equal to a number |
if | 3 | Boolean, Any, Any | If the first argument is true, returns the second argument, otherwise, returns the third |
contains | 2 | Tuple, any non-tuple | Returns true if second argument exists in first tuple argument. |
contains_any | 2 | Tuple, Tuple of any non-tuple | Returns true if one of the values in the second tuple argument exists in first tuple argument. |
typeof | 1 | Any | returns "string", "float", "int", "boolean", "tuple", or "empty" depending on the type of the argument |
String Functions
Identifier | Argument Amount | Argument Types | Description |
---|---|---|---|
str::regex_matches | 2 | String, String | Returns true if the first argument matches the regex in the second argument (Requires regex_support feature flag) |
str::regex_replace | 3 | String, String, String | Returns the first argument with all matches of the regex in the second argument replaced by the third argument (Requires regex_supportfeature flag) |
str::to_lowercase | 1 | String | Returns the lower-case version of the string |
str::to_uppercase | 1 | String | Returns the upper-case version of the string |
str::trim | 1 | String | Strips whitespace from the start and the end of the string |
str::from | >= 0 | Any | Returns passed value as string |
str::substring | 3 | String, Int, Int | Returns a substring of the first argument, starting at the second argument and ending at the third argument. If the last argument is omitted, the substring extends to the end of the string |
Mathematical Functions: Common
Identifier | Argument Amount | Argument Types | Description |
---|---|---|---|
math::abs | 1 | Numeric | Returns the absolute value of a number, returning an integer if the argument was an integer, and a float otherwise |
math::is_nan | 1 | Numeric | Returns true if the argument is the floating-point value NaN, false if it is another floating-point value, and throws an error if it is not a number |
math::is_finite | 1 | Numeric | Returns true if the argument is a finite floating-point number, false otherwise |
math::is_infinite | 1 | Numeric | Returns true if the argument is an infinite floating-point number, false otherwise |
math::is_normal | 1 | Numeric | Returns true if the argument is a floating-point number that is neither zero, infinite, subnormal, or NaN, false otherwise |
Mathematical Functions: Logarithms and Exponents
Identifier | Argument Amount | Argument Types | Description |
---|---|---|---|
math::ln | 1 | Numeric | Returns the natural logarithm of the number |
math::log | 2 | Numeric, Numeric | Returns the logarithm of the number with respect to an arbitrary base |
math::log2 | 1 | Numeric | Returns the base 2 logarithm of the number |
math::log10 | 1 | Numeric | Returns the base 10 logarithm of the number |
math::exp | 1 | Numeric | Returns e^(number), (the exponential function) |
math::exp2 | 1 | Numeric | Returns 2^(number) |
math::pow | 2 | Numeric, Numeric | Raises a number to the power of the other number |
math::sqrt | 1 | Numeric | Returns the square root of a number. Returns NaN for a negative number |
math::cbrt | 1 | Numeric | Returns the cube root of a number |
Mathematical Functions: Trigonometry
Identifier | Argument Amount | Argument Types | Description |
---|---|---|---|
math::cos | 1 | Numeric | Computes the cosine of a number (in radians) |
math::acos | 1 | Numeric | Computes the arccosine of a number. The return value is in radians in the range [0, pi] or NaN if the number is outside the range [-1, 1] |
math::cosh | 1 | Numeric | Hyperbolic cosine function |
math::acosh | 1 | Numeric | Inverse hyperbolic cosine function |
math::sin | 1 | Numeric | Computes the sine of a number (in radians) |
math::asin | 1 | Numeric | Computes the arcsine of a number. The return value is in radians in the range [-pi/2, pi/2] or NaN if the number is outside the range [-1, 1] |
math::sinh | 1 | Numeric | Hyperbolic sine function |
math::asinh | 1 | Numeric | Inverse hyperbolic sine function |
math::tan | 1 | Numeric | Computes the tangent of a number (in radians) |
math::atan | 1 | Numeric | Computes the arctangent of a number. The return value is in radians in the range [-pi/2, pi/2] |
math::atan2 | 2 | Numeric, Numeric | Computes the four quadrant arctangent in radians |
math::tanh | 1 | Numeric | Hyperbolic tangent function |
math::atanh | 1 | Numeric | Inverse hyperbolic tangent function. |
math::hypot | 2 | Numeric | Calculates the length of the hypotenuse of a right-angle triangle given legs of length given by the two arguments |