To add custom ranking attributes via the API Client,
1. First, you would need to specify the custom ranking attributes using the setSettings method. For example,
index.setSettings({
customRanking:[
'desc(popularity)',
'asc(price)'
]
}).then(()=>{
// done
});
You can see code examples here.
2. Then, you can pass the ‘custom’ criterion at the bottom in ranking.
ranking: [ // the `asc` and `desc` modifiers must be placed at the top // if you are configuring an index for sorting purposes only 'asc(attribute1)', 'desc(attribute2)', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact', 'custom' ]