Why doesn't RRF handle tied scores with equal ranking instead of using positional ranking?
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
### Description
Hello, I have a question about the RRF method in TopDocs and would like to raise this issue.
In the current code:
`for (int i = 0; i < topDoc.scoreDocs.length; ++i) {
ScoreDoc scoreDoc = topDoc.scoreDocs[i];
int rank = i + 1;
double rrfScoreContribution = 1d / Math.addExact(k, rank);
rrfScore.compute(
new ShardIndexAndDoc(scoreDoc.shardIndex, scoreDoc.doc),
(key, score) -> (score == null ? 0 : score) + rrfScoreContribution);
}`
The rank is unconditionally incremented by 1 (i + 1) based on position. However, when all documents have identical scores (such as search results on keyword fields), this approach could lead to incorrect RRF scores.
I'm curious about why documents with identical scores are not assigned the same rank. Shouldn't tied scores receive equal ranking treatment?
Contributor guide
Research direction
Start with the RRF score accumulation code in TopDocs shown in the issue, focusing on how rank is derived from each ScoreDoc's position. Compare positional ranking with equal-score tie handling and establish the expected RRF contributions for tied documents. Done means the intended ranking behavior is decided and covered by the relevant tests or documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100