order was undefined in case of duplicate sort keys, this could lead to incorrect results (documents appearing twice in the result set, other documents missing) if there were more than 100 matches.

PR:31241


git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150523 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Daniel Naber 2004-09-18 18:21:17 +00:00
parent ba6bb29e3b
commit 65ce0a021b
1 changed files with 3 additions and 0 deletions

View File

@ -95,6 +95,9 @@ extends PriorityQueue {
c = (fields[i].reverse) ? comparators[i].compare (docB, docA)
: comparators[i].compare (docA, docB);
}
// avoid random sort order that could lead to duplicates (bug #31241):
if (c == 0)
return docA.doc > docB.doc;
return c > 0;
}