customRanking
[]
(no custom ranking)
Can be used in these methods:
setSettings
set_settings
setSettings
set_settings
setSettings
setSettings
SetSettings
setSettings
SetSettings
setSettings
About this parameter
Specifies the custom
ranking criterion.
Each string must conform to the syntax asc(${attributeName})
or desc(${attributeName})
and specifies a
(respectively) increasing or decreasing sort on an attribute. All sorts are applied in sequence by the tie-breaking
algorithm in the order they are specified.
Modifiers:
-
asc: Sort by increasing value of the attribute.
-
desc: Sort by decreasing value of the attribute.
Examples
Set a custom ranking
In this example we will sort by decreasing value of the popularity
attribute,
then in case of equality by increasing value of the price
attribute
1
2
3
4
5
6
$index->setSettings([
'customRanking' => [
'desc(popularity)',
'asc(price)'
]
]);