Andreas
Andreas

Reputation: 462

Algolia Ranking and Sorting not applying as expected

We're having a few dozen indexes with about ~2.5k records each. Now the ranking and sorting is something we cannot wrap our heads around. For most cases it works as expected, but there are a few records that don't make sense to us.

Search term: i 16 (space before the 16)

The results are:

The most relevant results are the ones at the very last. While I understand that the first two are up there because of the two 16, I don't understand why the remaining in the middle are above the actual, most relevant ones.

We cannot change ASC to DESC since that would mess up the rest of the search, which is just fine.

Also, we are not sure what this means, since we clear our indexes before filling with new data.

enter image description here

Here are a few screenshots of the settings:

enter image description here

enter image description here

enter image description here

Can anybody solve this mystery for us?

Upvotes: 1

Views: 656

Answers (1)

PLNech
PLNech

Reputation: 3177

Your ranking formula is sorting all results by name, ascending (in alphabetical order), due to the Sort-By setting of your setup.

This is explained in Algolia's documentation for sorting records by attribute:

The goal of attribute-based sorting is to ensure all records which match the query appear in the order determined by the sort-by attribute.

This means that when a query returns N results, the Algolia engine will return these N results sorted by name. This explains why all the records named A**** are ranked higher than the records named i****.

If you want your Algolia results sorted by relevance, you should remove any Sort-By attribute.

Upvotes: 1

Related Questions