mirror of https://github.com/apache/lucene.git
prevent emtpy TopDocs from contributing to maxScore if searches are concurrent
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1066764 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
159c733369
commit
7161062eee
|
@ -373,8 +373,10 @@ public class IndexSearcher {
|
||||||
int totalHits = 0;
|
int totalHits = 0;
|
||||||
float maxScore = Float.NEGATIVE_INFINITY;
|
float maxScore = Float.NEGATIVE_INFINITY;
|
||||||
for (final TopDocs topDocs : runner) {
|
for (final TopDocs topDocs : runner) {
|
||||||
totalHits += topDocs.totalHits;
|
if(topDocs.totalHits != 0) {
|
||||||
maxScore = Math.max(maxScore, topDocs.getMaxScore());
|
totalHits += topDocs.totalHits;
|
||||||
|
maxScore = Math.max(maxScore, topDocs.getMaxScore());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final ScoreDoc[] scoreDocs = new ScoreDoc[hq.size()];
|
final ScoreDoc[] scoreDocs = new ScoreDoc[hq.size()];
|
||||||
|
@ -451,8 +453,10 @@ public class IndexSearcher {
|
||||||
int totalHits = 0;
|
int totalHits = 0;
|
||||||
float maxScore = Float.NEGATIVE_INFINITY;
|
float maxScore = Float.NEGATIVE_INFINITY;
|
||||||
for (final TopFieldDocs topFieldDocs : runner) {
|
for (final TopFieldDocs topFieldDocs : runner) {
|
||||||
totalHits += topFieldDocs.totalHits;
|
if (topFieldDocs.totalHits != 0) {
|
||||||
maxScore = Math.max(maxScore, topFieldDocs.getMaxScore());
|
totalHits += topFieldDocs.totalHits;
|
||||||
|
maxScore = Math.max(maxScore, topFieldDocs.getMaxScore());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
final ScoreDoc[] scoreDocs = new ScoreDoc[hq.size()];
|
final ScoreDoc[] scoreDocs = new ScoreDoc[hq.size()];
|
||||||
for (int i = hq.size() - 1; i >= 0; i--) // put docs in array
|
for (int i = hq.size() - 1; i >= 0; i--) // put docs in array
|
||||||
|
|
Loading…
Reference in New Issue