jpountz commented on code in PR #12442:
URL: https://github.com/apache/lucene/pull/12442#discussion_r1269425544


##########
lucene/test-framework/src/java/org/apache/lucene/tests/search/QueryUtils.java:
##########
@@ -675,7 +675,14 @@ public static void checkBulkScorerSkipTo(Random r, Query 
query, IndexSearcher se
     query = searcher.rewrite(query);
     Weight weight = searcher.createWeight(query, ScoreMode.COMPLETE, 1);
     for (LeafReaderContext context : searcher.getIndexReader().leaves()) {
-      final Scorer scorer = weight.scorer(context);
+      final Scorer scorer;
+      if (weight.scorerSupplier(context) != null) {
+        // For IndexOrDocValuesQuey, the bulk scorer will use the indexed 
structure query
+        // and the scorer with a lead cost of 0 will use the doc values query.
+        scorer = weight.scorerSupplier(context).get(0);
+      } else {
+        scorer = weight.scorer(context);

Review Comment:
   Should we set `scorer` to `null` here? A null `scorerSupplier` indicates no 
matches.
   
   ```suggestion
           scorer = null;
   ```



##########
lucene/test-framework/src/java/org/apache/lucene/tests/search/QueryUtils.java:
##########
@@ -675,7 +675,14 @@ public static void checkBulkScorerSkipTo(Random r, Query 
query, IndexSearcher se
     query = searcher.rewrite(query);
     Weight weight = searcher.createWeight(query, ScoreMode.COMPLETE, 1);
     for (LeafReaderContext context : searcher.getIndexReader().leaves()) {
-      final Scorer scorer = weight.scorer(context);
+      final Scorer scorer;
+      if (weight.scorerSupplier(context) != null) {
+        // For IndexOrDocValuesQuey, the bulk scorer will use the indexed 
structure query
+        // and the scorer with a lead cost of 0 will use the doc values query.
+        scorer = weight.scorerSupplier(context).get(0);

Review Comment:
   Let's call `scorerSupplier` only once as it could be expensive on queries 
that don't implement it directly since it delegates to `scorer`?



-- 
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-unsubscr...@lucene.apache.org

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


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

Reply via email to