You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2022/02/02 14:21:44 UTC

[GitHub] [lucene] javanna opened a new pull request #639: LUCENE-10002: Replace some IndexSearcher#search(Collector, Query) in tests

javanna opened a new pull request #639:
URL: https://github.com/apache/lucene/pull/639


   This is another one of many steps towards resolution of LUCENE-10002. In this PR I am replacing some usages of SimpleCollector extension in tests with a corresponding CollectorManager. In a few cases the test was not using LuceneTestCase#newSearcher hence I attempted addressing that too when applicable.
   
   # Checklist
   
   Please review the following and check all that apply:
   
   - [x] I have reviewed the guidelines for [How to Contribute](https://wiki.apache.org/lucene/HowToContribute) and my code conforms to the standards described there to the best of my ability.
   - [x] I have created a Jira issue and added the issue ID to my pull request title.
   - [ ] I have given Lucene maintainers [access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork) to contribute to my PR branch. (optional but recommended)
   - [x] I have developed this patch against the `main` branch.
   - [x] I have run `./gradlew check`.
   - [ ] I have added tests for my changes. (not applicable)
   


-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] jpountz commented on a change in pull request #639: LUCENE-10002: Replace some IndexSearcher#search(Collector, Query) in tests

Posted by GitBox <gi...@apache.org>.
jpountz commented on a change in pull request #639:
URL: https://github.com/apache/lucene/pull/639#discussion_r797855989



##########
File path: lucene/core/src/test/org/apache/lucene/search/TestBooleanQuery.java
##########
@@ -492,33 +493,43 @@ private void assertSameScoresWithoutFilters(IndexSearcher searcher, BooleanQuery
     final AtomicBoolean matched = new AtomicBoolean();
     searcher.search(
         bq,
-        new SimpleCollector() {
-          int docBase;
-          Scorable scorer;
-
+        new CollectorManager<SimpleCollector, Boolean>() {
           @Override
-          protected void doSetNextReader(LeafReaderContext context) throws IOException {
-            super.doSetNextReader(context);
-            docBase = context.docBase;
-          }
-
-          @Override
-          public ScoreMode scoreMode() {
-            return ScoreMode.COMPLETE;
+          public SimpleCollector newCollector() {
+            return new SimpleCollector() {
+              int docBase;
+              Scorable scorer;
+
+              @Override
+              protected void doSetNextReader(LeafReaderContext context) throws IOException {
+                super.doSetNextReader(context);
+                docBase = context.docBase;
+              }
+
+              @Override
+              public ScoreMode scoreMode() {
+                return ScoreMode.COMPLETE;
+              }
+
+              @Override
+              public void setScorer(Scorable scorer) {
+                this.scorer = scorer;
+              }
+
+              @Override
+              public void collect(int doc) throws IOException {
+                final float actualScore = scorer.score();
+                final float expectedScore =
+                    searcher.explain(bq2, docBase + doc).getValue().floatValue();
+                assertEquals(expectedScore, actualScore, 10e-5);
+                matched.set(true);
+              }
+            };
           }
 
           @Override
-          public void setScorer(Scorable scorer) throws IOException {
-            this.scorer = scorer;
-          }
-
-          @Override
-          public void collect(int doc) throws IOException {
-            final float actualScore = scorer.score();
-            final float expectedScore =
-                searcher.explain(bq2, docBase + doc).getValue().floatValue();
-            assertEquals(expectedScore, actualScore, 10e-5);
-            matched.set(true);
+          public Boolean reduce(Collection<SimpleCollector> collectors) {

Review comment:
       use Void like in other places to to better set the expectation that the return value is irrelevant?

##########
File path: lucene/core/src/test/org/apache/lucene/search/TestBooleanQuery.java
##########
@@ -492,33 +493,43 @@ private void assertSameScoresWithoutFilters(IndexSearcher searcher, BooleanQuery
     final AtomicBoolean matched = new AtomicBoolean();
     searcher.search(
         bq,
-        new SimpleCollector() {
-          int docBase;
-          Scorable scorer;
-
+        new CollectorManager<SimpleCollector, Boolean>() {
           @Override
-          protected void doSetNextReader(LeafReaderContext context) throws IOException {
-            super.doSetNextReader(context);
-            docBase = context.docBase;
-          }
-
-          @Override
-          public ScoreMode scoreMode() {
-            return ScoreMode.COMPLETE;
+          public SimpleCollector newCollector() {
+            return new SimpleCollector() {
+              int docBase;
+              Scorable scorer;
+
+              @Override
+              protected void doSetNextReader(LeafReaderContext context) throws IOException {
+                super.doSetNextReader(context);
+                docBase = context.docBase;
+              }
+
+              @Override
+              public ScoreMode scoreMode() {
+                return ScoreMode.COMPLETE;
+              }
+
+              @Override
+              public void setScorer(Scorable scorer) {
+                this.scorer = scorer;

Review comment:
       I'd prefer to keep things as they are. It requires more lines of code, but then if we add a new abstraction then you need to know what it's doing whenever you see it used, which is non-negligible cognitive overhead.

##########
File path: lucene/core/src/test/org/apache/lucene/index/TestOmitTf.java
##########
@@ -219,160 +221,101 @@ public void testBasic() throws Exception {
 
     searcher.search(
         q1,
-        new CountingHitCollector() {
-          private Scorable scorer;
-
-          @Override
-          public ScoreMode scoreMode() {
-            return ScoreMode.COMPLETE;
-          }
-
+        new CollectorManager<SimpleCollector, Void>() {
           @Override
-          public final void setScorer(Scorable scorer) {
-            this.scorer = scorer;
+          public SimpleCollector newCollector() {
+            return new ScoreAssertingCollector() {
+              @Override
+              public void collect(int doc) throws IOException {
+                // System.out.println("Q1: Doc=" + doc + " score=" + score);
+                float score = scorer.score();
+                assertTrue("got score=" + score, score == 1.0f);
+              }
+            };
           }
 
           @Override
-          public final void collect(int doc) throws IOException {
-            // System.out.println("Q1: Doc=" + doc + " score=" + score);
-            float score = scorer.score();
-            assertTrue("got score=" + score, score == 1.0f);
-            super.collect(doc);
+          public Void reduce(Collection<SimpleCollector> collectors) {
+            return null;
           }
         });
-    // System.out.println(CountingHitCollector.getCount());
 
     searcher.search(
         q2,
-        new CountingHitCollector() {
-          private Scorable scorer;
-
-          @Override
-          public ScoreMode scoreMode() {
-            return ScoreMode.COMPLETE;
-          }
-
+        new CollectorManager<SimpleCollector, Void>() {
           @Override
-          public final void setScorer(Scorable scorer) {
-            this.scorer = scorer;
+          public SimpleCollector newCollector() {
+            return new ScoreAssertingCollector() {
+              @Override
+              public void collect(int doc) throws IOException {
+                // System.out.println("Q2: Doc=" + doc + " score=" + score);
+                float score = scorer.score();
+                assertEquals(1.0f + doc, score, 0.00001f);
+              }
+            };
           }
 
           @Override
-          public final void collect(int doc) throws IOException {
-            // System.out.println("Q2: Doc=" + doc + " score=" + score);
-            float score = scorer.score();
-            assertEquals(1.0f + doc, score, 0.00001f);
-            super.collect(doc);
+          public Void reduce(Collection<SimpleCollector> collectors) {
+            return null;
           }
         });
-    // System.out.println(CountingHitCollector.getCount());
 
     searcher.search(
         q3,
-        new CountingHitCollector() {
-          private Scorable scorer;
-
-          @Override
-          public ScoreMode scoreMode() {
-            return ScoreMode.COMPLETE;
-          }
-
+        new CollectorManager<SimpleCollector, Void>() {
           @Override
-          public final void setScorer(Scorable scorer) {
-            this.scorer = scorer;
+          public SimpleCollector newCollector() {
+            return new ScoreAssertingCollector() {
+              @Override
+              public void collect(int doc) throws IOException {
+                // System.out.println("Q1: Doc=" + doc + " score=" + score);
+                float score = scorer.score();
+                assertTrue(score == 1.0f);
+                assertFalse(doc % 2 == 0);
+              }
+            };
           }
 
           @Override
-          public final void collect(int doc) throws IOException {
-            // System.out.println("Q1: Doc=" + doc + " score=" + score);
-            float score = scorer.score();
-            assertTrue(score == 1.0f);
-            assertFalse(doc % 2 == 0);
-            super.collect(doc);
+          public Void reduce(Collection<SimpleCollector> collectors) {
+            return null;
           }
         });
-    // System.out.println(CountingHitCollector.getCount());

Review comment:
       It's ok to remove them.




-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] javanna commented on a change in pull request #639: LUCENE-10002: Replace some IndexSearcher#search(Collector, Query) in tests

Posted by GitBox <gi...@apache.org>.
javanna commented on a change in pull request #639:
URL: https://github.com/apache/lucene/pull/639#discussion_r798383042



##########
File path: lucene/core/src/test/org/apache/lucene/search/TestBooleanQuery.java
##########
@@ -492,33 +493,43 @@ private void assertSameScoresWithoutFilters(IndexSearcher searcher, BooleanQuery
     final AtomicBoolean matched = new AtomicBoolean();
     searcher.search(
         bq,
-        new SimpleCollector() {
-          int docBase;
-          Scorable scorer;
-
+        new CollectorManager<SimpleCollector, Boolean>() {
           @Override
-          protected void doSetNextReader(LeafReaderContext context) throws IOException {
-            super.doSetNextReader(context);
-            docBase = context.docBase;
-          }
-
-          @Override
-          public ScoreMode scoreMode() {
-            return ScoreMode.COMPLETE;
+          public SimpleCollector newCollector() {
+            return new SimpleCollector() {
+              int docBase;
+              Scorable scorer;
+
+              @Override
+              protected void doSetNextReader(LeafReaderContext context) throws IOException {
+                super.doSetNextReader(context);
+                docBase = context.docBase;
+              }
+
+              @Override
+              public ScoreMode scoreMode() {
+                return ScoreMode.COMPLETE;
+              }
+
+              @Override
+              public void setScorer(Scorable scorer) {
+                this.scorer = scorer;
+              }
+
+              @Override
+              public void collect(int doc) throws IOException {
+                final float actualScore = scorer.score();
+                final float expectedScore =
+                    searcher.explain(bq2, docBase + doc).getValue().floatValue();
+                assertEquals(expectedScore, actualScore, 10e-5);
+                matched.set(true);
+              }
+            };
           }
 
           @Override
-          public void setScorer(Scorable scorer) throws IOException {
-            this.scorer = scorer;
-          }
-
-          @Override
-          public void collect(int doc) throws IOException {
-            final float actualScore = scorer.score();
-            final float expectedScore =
-                searcher.explain(bq2, docBase + doc).getValue().floatValue();
-            assertEquals(expectedScore, actualScore, 10e-5);
-            matched.set(true);
+          public Boolean reduce(Collection<SimpleCollector> collectors) {

Review comment:
       this is a leftover from a previous attempt, thanks for catching it




-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] javanna commented on a change in pull request #639: LUCENE-10002: Replace some IndexSearcher#search(Collector, Query) in tests

Posted by GitBox <gi...@apache.org>.
javanna commented on a change in pull request #639:
URL: https://github.com/apache/lucene/pull/639#discussion_r798382358



##########
File path: lucene/core/src/test/org/apache/lucene/search/TestBooleanQuery.java
##########
@@ -492,33 +493,43 @@ private void assertSameScoresWithoutFilters(IndexSearcher searcher, BooleanQuery
     final AtomicBoolean matched = new AtomicBoolean();
     searcher.search(
         bq,
-        new SimpleCollector() {
-          int docBase;
-          Scorable scorer;
-
+        new CollectorManager<SimpleCollector, Boolean>() {
           @Override
-          protected void doSetNextReader(LeafReaderContext context) throws IOException {
-            super.doSetNextReader(context);
-            docBase = context.docBase;
-          }
-
-          @Override
-          public ScoreMode scoreMode() {
-            return ScoreMode.COMPLETE;
+          public SimpleCollector newCollector() {
+            return new SimpleCollector() {
+              int docBase;
+              Scorable scorer;
+
+              @Override
+              protected void doSetNextReader(LeafReaderContext context) throws IOException {
+                super.doSetNextReader(context);
+                docBase = context.docBase;
+              }
+
+              @Override
+              public ScoreMode scoreMode() {
+                return ScoreMode.COMPLETE;
+              }
+
+              @Override
+              public void setScorer(Scorable scorer) {
+                this.scorer = scorer;

Review comment:
       ++ agreed




-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] javanna commented on a change in pull request #639: LUCENE-10002: Replace some IndexSearcher#search(Collector, Query) in tests

Posted by GitBox <gi...@apache.org>.
javanna commented on a change in pull request #639:
URL: https://github.com/apache/lucene/pull/639#discussion_r797657558



##########
File path: lucene/core/src/test/org/apache/lucene/search/TestBooleanQueryVisitSubscorers.java
##########
@@ -70,10 +72,7 @@ public void setUp() throws Exception {
             "nutch is an internet search engine with web crawler and is using lucene and hadoop"));
     reader = writer.getReader();
     writer.close();
-    // we do not use newSearcher because the assertingXXX layers break
-    // the toString representations we are relying on
-    // TODO: clean that up
-    searcher = new IndexSearcher(reader);
+    searcher = newSearcher(reader, true, false);
     searcher.setSimilarity(new ClassicSimilarity());
     scorerSearcher = new ScorerIndexSearcher(reader);

Review comment:
       I did not find an easy way to wrap this so that the random aspects of calling newSearcher are applied to it as well. Not sure if I missed something and whether it even makes sense to do so.




-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] javanna commented on a change in pull request #639: LUCENE-10002: Replace some IndexSearcher#search(Collector, Query) in tests

Posted by GitBox <gi...@apache.org>.
javanna commented on a change in pull request #639:
URL: https://github.com/apache/lucene/pull/639#discussion_r797657558



##########
File path: lucene/core/src/test/org/apache/lucene/search/TestBooleanQueryVisitSubscorers.java
##########
@@ -70,10 +72,7 @@ public void setUp() throws Exception {
             "nutch is an internet search engine with web crawler and is using lucene and hadoop"));
     reader = writer.getReader();
     writer.close();
-    // we do not use newSearcher because the assertingXXX layers break
-    // the toString representations we are relying on
-    // TODO: clean that up
-    searcher = new IndexSearcher(reader);
+    searcher = newSearcher(reader, true, false);
     searcher.setSimilarity(new ClassicSimilarity());
     scorerSearcher = new ScorerIndexSearcher(reader);

Review comment:
       I did not find an easy way to wrap this so that the random aspects of calling newSearcher are applied to it as well. Not sure if I missed something and whether it even makes sense to attempt that.




-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] jpountz merged pull request #639: LUCENE-10002: Replace some IndexSearcher#search(Collector, Query) in tests

Posted by GitBox <gi...@apache.org>.
jpountz merged pull request #639:
URL: https://github.com/apache/lucene/pull/639


   


-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] javanna commented on a change in pull request #639: LUCENE-10002: Replace some IndexSearcher#search(Collector, Query) in tests

Posted by GitBox <gi...@apache.org>.
javanna commented on a change in pull request #639:
URL: https://github.com/apache/lucene/pull/639#discussion_r797656068



##########
File path: lucene/core/src/test/org/apache/lucene/index/TestOmitTf.java
##########
@@ -219,160 +221,101 @@ public void testBasic() throws Exception {
 
     searcher.search(
         q1,
-        new CountingHitCollector() {
-          private Scorable scorer;
-
-          @Override
-          public ScoreMode scoreMode() {
-            return ScoreMode.COMPLETE;
-          }
-
+        new CollectorManager<SimpleCollector, Void>() {
           @Override
-          public final void setScorer(Scorable scorer) {
-            this.scorer = scorer;
+          public SimpleCollector newCollector() {
+            return new ScoreAssertingCollector() {
+              @Override
+              public void collect(int doc) throws IOException {
+                // System.out.println("Q1: Doc=" + doc + " score=" + score);
+                float score = scorer.score();
+                assertTrue("got score=" + score, score == 1.0f);
+              }
+            };
           }
 
           @Override
-          public final void collect(int doc) throws IOException {
-            // System.out.println("Q1: Doc=" + doc + " score=" + score);
-            float score = scorer.score();
-            assertTrue("got score=" + score, score == 1.0f);
-            super.collect(doc);
+          public Void reduce(Collection<SimpleCollector> collectors) {
+            return null;
           }
         });
-    // System.out.println(CountingHitCollector.getCount());
 
     searcher.search(
         q2,
-        new CountingHitCollector() {
-          private Scorable scorer;
-
-          @Override
-          public ScoreMode scoreMode() {
-            return ScoreMode.COMPLETE;
-          }
-
+        new CollectorManager<SimpleCollector, Void>() {
           @Override
-          public final void setScorer(Scorable scorer) {
-            this.scorer = scorer;
+          public SimpleCollector newCollector() {
+            return new ScoreAssertingCollector() {
+              @Override
+              public void collect(int doc) throws IOException {
+                // System.out.println("Q2: Doc=" + doc + " score=" + score);
+                float score = scorer.score();
+                assertEquals(1.0f + doc, score, 0.00001f);
+              }
+            };
           }
 
           @Override
-          public final void collect(int doc) throws IOException {
-            // System.out.println("Q2: Doc=" + doc + " score=" + score);
-            float score = scorer.score();
-            assertEquals(1.0f + doc, score, 0.00001f);
-            super.collect(doc);
+          public Void reduce(Collection<SimpleCollector> collectors) {
+            return null;
           }
         });
-    // System.out.println(CountingHitCollector.getCount());
 
     searcher.search(
         q3,
-        new CountingHitCollector() {
-          private Scorable scorer;
-
-          @Override
-          public ScoreMode scoreMode() {
-            return ScoreMode.COMPLETE;
-          }
-
+        new CollectorManager<SimpleCollector, Void>() {
           @Override
-          public final void setScorer(Scorable scorer) {
-            this.scorer = scorer;
+          public SimpleCollector newCollector() {
+            return new ScoreAssertingCollector() {
+              @Override
+              public void collect(int doc) throws IOException {
+                // System.out.println("Q1: Doc=" + doc + " score=" + score);
+                float score = scorer.score();
+                assertTrue(score == 1.0f);
+                assertFalse(doc % 2 == 0);
+              }
+            };
           }
 
           @Override
-          public final void collect(int doc) throws IOException {
-            // System.out.println("Q1: Doc=" + doc + " score=" + score);
-            float score = scorer.score();
-            assertTrue(score == 1.0f);
-            assertFalse(doc % 2 == 0);
-            super.collect(doc);
+          public Void reduce(Collection<SimpleCollector> collectors) {
+            return null;
           }
         });
-    // System.out.println(CountingHitCollector.getCount());

Review comment:
       I wonder if I need to keep these System.out. In that case, it is not complicated to make the collector manager expose the count. I did not do it because these are all commented out and I wonder if we should just remove these lines instead.




-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] javanna commented on pull request #639: LUCENE-10002: Replace some IndexSearcher#search(Collector, Query) in tests

Posted by GitBox <gi...@apache.org>.
javanna commented on pull request #639:
URL: https://github.com/apache/lucene/pull/639#issuecomment-1028873856


   This should be good to go now ;)


-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] javanna commented on a change in pull request #639: LUCENE-10002: Replace some IndexSearcher#search(Collector, Query) in tests

Posted by GitBox <gi...@apache.org>.
javanna commented on a change in pull request #639:
URL: https://github.com/apache/lucene/pull/639#discussion_r797660275



##########
File path: lucene/core/src/test/org/apache/lucene/search/TestBooleanQuery.java
##########
@@ -492,33 +493,43 @@ private void assertSameScoresWithoutFilters(IndexSearcher searcher, BooleanQuery
     final AtomicBoolean matched = new AtomicBoolean();
     searcher.search(
         bq,
-        new SimpleCollector() {
-          int docBase;
-          Scorable scorer;
-
+        new CollectorManager<SimpleCollector, Boolean>() {
           @Override
-          protected void doSetNextReader(LeafReaderContext context) throws IOException {
-            super.doSetNextReader(context);
-            docBase = context.docBase;
-          }
-
-          @Override
-          public ScoreMode scoreMode() {
-            return ScoreMode.COMPLETE;
+          public SimpleCollector newCollector() {
+            return new SimpleCollector() {
+              int docBase;
+              Scorable scorer;
+
+              @Override
+              protected void doSetNextReader(LeafReaderContext context) throws IOException {
+                super.doSetNextReader(context);
+                docBase = context.docBase;
+              }
+
+              @Override
+              public ScoreMode scoreMode() {
+                return ScoreMode.COMPLETE;
+              }
+
+              @Override
+              public void setScorer(Scorable scorer) {
+                this.scorer = scorer;

Review comment:
       these implementations of scoreMode and setScorer seem quite common, I wonder if it'd make sense to extract it out to a base test collector within test framework, of maybe it is overkill?




-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org