Custom ranking rules promote certain documents over other search results that are otherwise equally relevant.
:
) and either asc
for ascending order or desc
for descending order.
attribute_name:asc
attribute_name:desc
release_date
with a timestamp as value, and movie_ranking
, an integer that represents its ranking.
The following example creates a rule that makes older movies more relevant than recent ones. A movie released in 1999 will appear before a movie released in 2020.
sort
search parameter. There is some overlap between sorting and custom ranking rules, but the two do have different uses.
In general, sort
will be most useful when you want to allow users to define what type of results they want to see first. A good use-case for sort
is creating a webshop interface where customers can sort products by descending or ascending product price.
Custom ranking rules, instead, are always active once configured and are useful when you want to promote certain types of results. A good use-case for custom ranking rules is ensuring discounted products in a webshop always feature among the top results.