mirror of https://github.com/apache/lucene.git
when merging TopDocs, the most hits we can produce is the sum of how many hits we actually received
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1140827 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
abdb8e0e2f
commit
4e92af1537
|
@ -212,18 +212,20 @@ public class TopDocs {
|
|||
}
|
||||
|
||||
int totalHitCount = 0;
|
||||
int availHitCount = 0;
|
||||
float maxScore = Float.MIN_VALUE;
|
||||
for(int shardIDX=0;shardIDX<shardHits.length;shardIDX++) {
|
||||
final TopDocs shard = shardHits[shardIDX];
|
||||
if (shard.scoreDocs != null && shard.scoreDocs.length > 0) {
|
||||
totalHitCount += shard.totalHits;
|
||||
availHitCount += shard.scoreDocs.length;
|
||||
queue.add(new ShardRef(shardIDX));
|
||||
maxScore = Math.max(maxScore, shard.getMaxScore());
|
||||
//System.out.println(" maxScore now " + maxScore + " vs " + shard.getMaxScore());
|
||||
}
|
||||
}
|
||||
|
||||
final ScoreDoc[] hits = new ScoreDoc[Math.min(topN, totalHitCount)];
|
||||
final ScoreDoc[] hits = new ScoreDoc[Math.min(topN, availHitCount)];
|
||||
|
||||
int hitUpto = 0;
|
||||
while(hitUpto < hits.length) {
|
||||
|
|
Loading…
Reference in New Issue