mirror of https://github.com/apache/lucene.git
fix bottomValueChecker assignment in index searcher
This commit is contained in:
parent
f55633c881
commit
1770f15bb5
|
@ -479,7 +479,7 @@ public class IndexSearcher {
|
|||
private final HitsThresholdChecker hitsThresholdChecker = (executor == null || leafSlices.length <= 1) ? HitsThresholdChecker.create(TOTAL_HITS_THRESHOLD) :
|
||||
HitsThresholdChecker.createShared(TOTAL_HITS_THRESHOLD);
|
||||
|
||||
private final BottomValueChecker bottomValueChecker = BottomValueChecker.createMaxBottomScoreChecker();
|
||||
private final BottomValueChecker bottomValueChecker = (executor == null || leafSlices.length <= 1) ? null : BottomValueChecker.createMaxBottomScoreChecker();
|
||||
|
||||
@Override
|
||||
public TopScoreDocCollector newCollector() throws IOException {
|
||||
|
@ -611,7 +611,8 @@ public class IndexSearcher {
|
|||
|
||||
private final HitsThresholdChecker hitsThresholdChecker = (executor == null || leafSlices.length <= 1) ? HitsThresholdChecker.create(TOTAL_HITS_THRESHOLD) :
|
||||
HitsThresholdChecker.createShared(TOTAL_HITS_THRESHOLD);
|
||||
private final BottomValueChecker bottomValueChecker = (executor == null || leafSlices.length <= 1) ? BottomValueChecker.createMaxBottomScoreChecker() : null;
|
||||
|
||||
private final BottomValueChecker bottomValueChecker = (executor == null || leafSlices.length <= 1) ? null : BottomValueChecker.createMaxBottomScoreChecker();
|
||||
|
||||
@Override
|
||||
public TopFieldCollector newCollector() throws IOException {
|
||||
|
|
|
@ -165,8 +165,8 @@ public abstract class TopFieldCollector extends TopDocsCollector<Entry> {
|
|||
add(slot, doc);
|
||||
if (queueFull) {
|
||||
comparator.setBottom(bottom.slot);
|
||||
updateMinCompetitiveScore(scorer, true);
|
||||
}
|
||||
updateMinCompetitiveScore(scorer, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,6 +251,7 @@ public abstract class TopFieldCollector extends TopDocsCollector<Entry> {
|
|||
final int topCmp = reverseMul * comparator.compareTop(doc);
|
||||
if (topCmp > 0 || (topCmp == 0 && doc <= afterDoc)) {
|
||||
// Already collected on a previous page
|
||||
updateMinCompetitiveScore(scorer, totalHitsRelation == Relation.EQUAL_TO);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -275,8 +276,8 @@ public abstract class TopFieldCollector extends TopDocsCollector<Entry> {
|
|||
queueFull = collectedHits == numHits;
|
||||
if (queueFull) {
|
||||
comparator.setBottom(bottom.slot);
|
||||
updateMinCompetitiveScore(scorer, true);
|
||||
}
|
||||
updateMinCompetitiveScore(scorer, true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -145,6 +145,10 @@ public abstract class TopScoreDocCollector extends TopDocsCollector<ScoreDoc> {
|
|||
}
|
||||
|
||||
if (score <= pqTop.score) {
|
||||
// the document is not competitive but we need to update the minimum competitive score
|
||||
// if we just reached the total hits threshold or if the global minimum score (bottomValueChecker)
|
||||
// has been updated
|
||||
updateMinCompetitiveScore(scorer, totalHitsRelation == TotalHits.Relation.EQUAL_TO);
|
||||
// Since docs are returned in-order (i.e., increasing doc Id), a document
|
||||
// with equal score to pqTop.score cannot compete since HitQueue favors
|
||||
// documents with lower doc Ids. Therefore reject those docs too.
|
||||
|
|
Loading…
Reference in New Issue