Ranking functions
Ranking functions
This is for:
DeveloperA ranking function is a mathematical expression evaluated against each item returned by a query. The QRF output for a given item generates a boost which is then added to the ranking score of that item.
This article describes the members of the structure that defines a single QRF.
You can specify an array of QRF in a query using the rankingFunctions
top-level query parameter.
You want to increase the ranking score of restaurant items by an amount varying from 0
to 500
, depending on how close they’re to the end-user location.
POST https://platform.cloud.coveo.com/rest/search/v2 HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: Bearer **********-****-****-****-************
Payload
{
"aq": "documenttype==Restaurant",
"rankingFunctions": [
{
"expression": "-sqrt(dist(@longitude, @latitude, 47.4953481, -121.7885868))",
"normalizeWeight": true,
"modifier": 500
}
]
}
200 OK response body (excerpt)
|
Note
Suppose that the values returned by the Then, the result for a restaurant item that has a
|