{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://raw.githubusercontent.com/api-evangelist/coveo/main/json-schema/coveo-search-restrankingfunction-schema.json", "title": "Coveo Search RestRankingFunction", "required": [ "expression" ], "type": "object", "properties": { "expression": { "type": "string", "description": "A mathematical expression to evaluate for each query result. The result of this expression for a given query result generates a boost which is then added to the ranking score of that query result.\n\n**Note:** Query ranking function expressions support the [ExprTk](http://www.partow.net/programming/exprtk/index.html) library syntax. However, the following statements are disabled:\n\n- `if`/`else`\n- `switch`\n- `while`\n- `repeat until`\n\nThe following time constants are also available in query ranking functions:\n\n- `NOW`: A value corresponding to the precise moment when the query reaches the index.\n- `YEAR`: A value corresponding to the duration of a year (i.e., 365.25 days).\n- `WEEK`: A value corresponding to the duration of a week.\n- `DAY`: A value corresponding to the duration of a day.\n\n**Tip:** If your query ranking function expression references certain numeric fields, you should ensure that the **Use cache for computed fields** option is enabled for each of those fields in order to speed up evaluation (see [Manage fields](https://docs.coveo.com/en/1833/)).", "example": "-sqrt(dist(@longitude, @latitude, 46.8167, -71.2167))" }, "normalizeWeight": { "type": "boolean", "description": "Whether to normalize the ranking score boosts resulting from the evaluation of this query ranking function using the standard index scale.\n\nUnless you want to completely override the index ranking and use the results of this query ranking function directly to boost the ranking scores of query results, you should set this to `true`.\n\n**Default:** `false`", "example": true, "default": false }, "modifier": { "type": "integer", "description": "The maximum boost this query ranking function can add to the ranking score of any given query result.\n\nThis property only has a meaning if `normalizeWeight` is set to `true`.\n\n**Default:** `600`", "format": "int64", "example": 100, "default": 600 } } }