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 2020/09/08 16:39:54 UTC

[GitHub] [lucene-solr] jtibshirani commented on a change in pull request #1834: Make sure to test normal scorers with asserting wrappers.

jtibshirani commented on a change in pull request #1834:
URL: https://github.com/apache/lucene-solr/pull/1834#discussion_r485055929



##########
File path: lucene/test-framework/src/java/org/apache/lucene/search/AssertingWeight.java
##########
@@ -85,11 +85,18 @@ public long cost() {
 
   @Override
   public BulkScorer bulkScorer(LeafReaderContext context) throws IOException {
-    BulkScorer inScorer = in.bulkScorer(context);
+    BulkScorer inScorer;
+    // We explicitly test both the delegate's bulk scorer, and also the normal scorer.
+    // This ensures that normal scorers are sometimes tested with an asserting wrapper.
+    if (random.nextBoolean()) {
+      inScorer = in.bulkScorer(context);
+    } else {
+      inScorer = super.bulkScorer(context);
+    }

Review comment:
       That makes sense to me, I can reduce the frequency with which we take the `Scorer` path.
   
   I didn't know about the practice of testing both with a top-level query and a filter. To me this change is still valuable, it ensures we check the scorer/ iterator contract sometimes in a clear + solid way.




----------------------------------------------------------------
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.

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