vibrantvarun commented on issue #14455: URL: https://github.com/apache/lucene/issues/14455#issuecomment-2797975149
Maybe something like this ``` private static final Comparator<ScoreDoc> SORTING_TIE_BREAKER = (o1, o2) -> { int scoreComparison = Double.compare(o1.score, o2.score); if (scoreComparison != 0) { return scoreComparison; } int docIdComparison = Integer.compare(o1.doc, o2.doc); if (docIdComparison != 0) { return docIdComparison; } // When duplicate result found then both score and doc ID are equal (o1.score == o2.score && o1.doc == o2.doc) then return 1 return 1; }; ``` 1. If sort field value of 2 documents is same then pick the one which has high score. 2. If sort field value of 2 documents is same and scores are also same then pick the one which has greater docId 3. If all parameters are same then essentially both are same objects, there for choose any -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org