Although sorting technically happens at each level of the ranking formula, on this page “sorting” refers to ordering records by a specific attribute like release date or price.
The challenge with sorting
Sorting exposes the difference between relevance and ranking.
Instead of ranking results based on textual and business ranking criteria, sorting ranks results based on attributes like price. This attribute may not be related to relevance. That means that any result, no matter how relevant it is, might be the first result.
For example, if a user sorts on price from lowest to highest, a record with a very low price may rank highest, even though it has less textual and business relevance than other records. This type of sorting is called exhaustive sorting or hard sorting. Despite being common, this behavior tends to hurt the search experience for most use cases because users don’t necessarily get what they’re looking for.
Returning to the preceding example: suppose a user searches “iPhone” and sorts results from lowest to highest price. The top results would be cheaper iPhone accessories like cases when the user was actually looking for the least expensive iPhones.
To solve for this behavior when it’s not explicitly required, Algolia supports two types of sorts.
Exhaustive and relevant sorting
Algolia provides two types of sorts:
- Exhaustive or hard sorting
- Relevant sorting
Your use case determines which is a better fit.
As previously described, exhaustive sorting is “strict” because it re-orders all results based on the sorting attributes. It’s intended for use cases that require exhaustivity or where relevance isn’t key, like an inventory app or other use cases similar to databases. Exhaustive sorting leverages standard replicas.
Relevant sorting reorders only relevant results. This behavior is a state of the art sorting experience, especially in ecommerce, marketplace, and media content discovery. Relevant sorting leverages virtual replicas.