mirror of https://github.com/apache/lucene.git
fix the logic to require the next float when checking the global minimum score
This commit is contained in:
parent
a35996fcbb
commit
66a8ad04e7
|
@ -243,7 +243,7 @@ public abstract class TopScoreDocCollector extends TopDocsCollector<ScoreDoc> {
|
|||
* and a shared {@link MaxScoreAccumulator} to propagate the minimum score accross segments
|
||||
*/
|
||||
public static CollectorManager<TopScoreDocCollector, TopDocs> createSharedManager(int numHits, FieldDoc after,
|
||||
int totalHitsThreshold, int maxDocs) {
|
||||
int totalHitsThreshold) {
|
||||
return new CollectorManager<>() {
|
||||
|
||||
private final HitsThresholdChecker hitsThresholdChecker = HitsThresholdChecker.createShared(totalHitsThreshold);
|
||||
|
@ -305,9 +305,9 @@ public abstract class TopScoreDocCollector extends TopDocsCollector<ScoreDoc> {
|
|||
DocAndScore maxMinScore = minScoreAcc.get();
|
||||
if (maxMinScore != null) {
|
||||
// since we tie-break on doc id and collect in doc id order we can require
|
||||
// the next float if the global minimum score is set on a document that is
|
||||
// greater than the ids in the current leaf
|
||||
float score = maxMinScore.docID > docBase ? Math.nextUp(maxMinScore.score) : maxMinScore.score;
|
||||
// the next float if the global minimum score is set on a document id that is
|
||||
// smaller than the ids in the current leaf
|
||||
float score = docBase > maxMinScore.docID ? Math.nextUp(maxMinScore.score) : maxMinScore.score;
|
||||
if (score > minCompetitiveScore) {
|
||||
assert hitsThresholdChecker.isThresholdReached();
|
||||
scorer.setMinCompetitiveScore(score);
|
||||
|
|
|
@ -129,7 +129,7 @@ public class TestTopDocsCollector extends LuceneTestCase {
|
|||
IndexSearcher searcher = new IndexSearcher(indexReader, service);
|
||||
|
||||
CollectorManager collectorManager = TopScoreDocCollector.createSharedManager(numResults,
|
||||
null, threshold, indexReader.maxDoc());
|
||||
null, threshold);
|
||||
|
||||
return (TopDocs) searcher.search(q, collectorManager);
|
||||
} finally {
|
||||
|
@ -417,7 +417,7 @@ public class TestTopDocsCollector extends LuceneTestCase {
|
|||
w.close();
|
||||
|
||||
CollectorManager<TopScoreDocCollector, TopDocs> manager =
|
||||
TopScoreDocCollector.createSharedManager(2, null, 0, reader.maxDoc());
|
||||
TopScoreDocCollector.createSharedManager(2, null, 0);
|
||||
TopScoreDocCollector collector = manager.newCollector();
|
||||
TopScoreDocCollector collector2 = manager.newCollector();
|
||||
assertTrue(collector.minScoreAcc == collector2.minScoreAcc);
|
||||
|
|
Loading…
Reference in New Issue