LUCENE-6878: Speed up TopDocs.merge.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1712298 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrien Grand 2015-11-03 14:18:20 +00:00
parent e777e4adb7
commit 724e803e19
2 changed files with 6 additions and 2 deletions

View File

@ -175,6 +175,8 @@ Optimizations
addresses for BINARY fields are now stored on disk instead of in memory.
(Adrien Grand)
* LUCENE-6878: Speed up TopDocs.merge. (Daniel Jelinski via Adrien Grand)
Bug Fixes
* LUCENE-6817: ComplexPhraseQueryParser.ComplexPhraseQuery does not display

View File

@ -272,7 +272,7 @@ public class TopDocs {
int hitUpto = 0;
while (hitUpto < numIterOnHits) {
assert queue.size() > 0;
ShardRef ref = queue.pop();
ShardRef ref = queue.top();
final ScoreDoc hit = shardHits[ref.shardIndex].scoreDocs[ref.hitIndex++];
hit.shardIndex = ref.shardIndex;
if (hitUpto >= start) {
@ -286,7 +286,9 @@ public class TopDocs {
if (ref.hitIndex < shardHits[ref.shardIndex].scoreDocs.length) {
// Not done with this these TopDocs yet:
queue.add(ref);
queue.updateTop();
} else {
queue.pop();
}
}
}