Goal
Documents with the same query score should display in a consistent order. By default, when documents have an identical score, they can change places. This is particularly bad when it happens near page breaks. For example, an e-commerce item might not be displayed if it flips spots when a user advances through pages.
Environment
Fusion (all versions), Solr (all versions)
Guide
To prevent documents from changing order if they have tied scores, sort by both scores and document IDs:
sort = score desc, id asc
The suggested resolution is to sort the search results using the following criteria:
-
Sort by Score (Descending): This ensures that documents with higher relevance scores are ranked higher in the search results, addressing the primary relevance requirement.
-
Sort by Document ID (Ascending): In case multiple documents have the same score, sorting them by document ID in ascending order ensures a consistent and predictable order among these documents.
In this configuration, we can notice
-
score desc
sorts of the documents in descending order of their relevance scores, with the highest-scoring documents appearing first. -
id asc
sorts the documents in ascending order of their document IDs. This secondary sorting criterion ensures that documents with the same score are ordered consistently based on their IDs.
By combining these sorting criteria, you can ensure that your search results are both relevant (based on scores) and predictable (based on IDs), which should address the issue of documents changing positions, especially near-page breaks in your search results.
article body post-text
Comments
0 comments
Article is closed for comments.