jpountz commented on a change in pull request #303:
URL: https://github.com/apache/lucene/pull/303#discussion_r710206139
##########
File path: lucene/core/src/test/org/apache/lucene/search/TestMultiCollector.java
##########
@@ -220,6 +220,68 @@ public void collect(int doc) throws IOException {
dir.close();
}
+ public void testDisablesSetMinScoreWithEarlyTermination() throws IOException
{
+ Directory dir = newDirectory();
+ IndexWriter w = new IndexWriter(dir, newIndexWriterConfig());
+ w.addDocument(new Document());
+ IndexReader reader = DirectoryReader.open(w);
+ w.close();
+
+ Scorable scorer =
+ new Scorable() {
+ @Override
+ public int docID() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public float score() {
+ return 0;
+ }
+
+ @Override
+ public void setMinCompetitiveScore(float minScore) {
+ throw new AssertionError();
+ }
+ };
+
+ Collector collector =
+ new SimpleCollector() {
+ private Scorable scorer;
+ float minScore = 0;
+
+ @Override
+ public ScoreMode scoreMode() {
+ return ScoreMode.TOP_SCORES;
+ }
+
+ @Override
+ public void setScorer(Scorable scorer) throws IOException {
+ this.scorer = scorer;
+ }
+
+ @Override
+ public void collect(int doc) throws IOException {
+ minScore = Math.nextUp(minScore);
+ scorer.setMinCompetitiveScore(minScore);
+ }
+ };
+ for (int numCol = 1; numCol < 4; numCol++) {
+ List<Collector> cols = new ArrayList<>();
+ cols.add(collector);
+ for (int col = 0; col < numCol; col++) {
+ cols.add(new TerminateAfterCollector(new TotalHitCountCollector(), 0));
+ }
+ Collector multiCollector = MultiCollector.wrap(cols);
Review comment:
maybe shuffle the list to make sure order doesn't affect
MultiCollector's behavior?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]