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/05 16:53:44 UTC

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

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



##########
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:
       I know of several tests that test first with a top-level query and then with a filter to make sure that both the bulk scorer and the scorer are tested. With this change, 50% of the time, we wouldn't be testing the bulk scorer, so I wonder if we should replace `random.nextBoolean()` with `frequently()` or something like 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.

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