Standard Replica's with a SortBy attribute perform whats called Exhaustive Sorting. Exhaustive sorting refers to strictly reordering results by an attribute. For example, you can exhaustively sort results from lowest to highest price, regardless of textual and business relevance.
If a sort-by attribute is present, the engine first orders results by the sort-by attribute’s value. Once sorted by the sort-by attribute’s value, products with the same sort-by attribute’s value are ordered according to Algolia’s default textual ranking criteria. Textual ranking criteria come after your selected sort-by attribute.
If you're not looking for strictly sorted results there is an alternative with Virtual Replicas called Relevant Sorting. With Relevant Sorting Algolia’s ranking formula isn’t turned off when you sort by an attribute. Instead, the relevant sorting algorithm selects results as follows:
- Selects results matching the user’s query by using the primary index’s ranking formula.
- Selects only the most relevant results. This a threshold set by the
relevancyStrictnesssetting. With ‘relevancyStrictness`, you instruct the engine to only return results with that relevancy score or better. At query time, the engine computes a relevancy score of 0-100 for each result (by comparing each hit to the best one, a score of 100).
- Sorts the selected results based on the virtual replica’s
- Returns the relevant results.
(Relevant sorting is only available on Premium plans.)