kkewwei commented on code in PR #16520:
URL: https://github.com/apache/lucene/pull/16520#discussion_r4027120973


##########
lucene/core/src/test/org/apache/lucene/search/TestMaxScoreBulkScorer.java:
##########
@@ -1447,6 +1477,70 @@ public void collect(int doc) {}
     dir.close();
   }
 
+  public void testTwoPhaseFilterUsesBitSet() throws IOException {
+    Directory dir = newDirectory();
+    IndexWriter w = new IndexWriter(dir, new IndexWriterConfig());
+    for (int i = 0; i < 10000; i++) {
+      Document doc = new Document();
+      doc.add(new TextField("body", "dense1", Field.Store.NO));
+      doc.add(new TextField("body", "dense2", Field.Store.NO));
+      doc.add(SortedNumericDocValuesField.indexedField("filter", i % 20));
+      w.addDocument(doc);
+    }
+    w.close();
+
+    DirectoryReader reader = DirectoryReader.open(dir);
+    IndexSearcher searcher = new IndexSearcher(reader);
+    searcher.setQueryCache(null);
+
+    BooleanQuery innerOr =
+        new BooleanQuery.Builder()
+            .add(new TermQuery(new Term("body", "dense1")), Occur.SHOULD)
+            .add(new TermQuery(new Term("body", "dense2")), Occur.SHOULD)
+            .build();
+
+    int[] twoPhaseIntoIntoBitSetCalls = {0};
+    int[] collectedDocs = {0};
+    Query delegateFilterQuery = 
SortedNumericDocValuesField.newSlowRangeQuery("filter", 1, 1);
+    Query filterQuery =
+        new CountingFilterQuery(delegateFilterQuery, null, 
twoPhaseIntoIntoBitSetCalls, new int[1]);
+    BooleanQuery outerQuery =
+        new BooleanQuery.Builder().add(innerOr, Occur.MUST).add(filterQuery, 
Occur.FILTER).build();
+
+    Query rewritten = searcher.rewrite(outerQuery);
+    Weight weight = searcher.createWeight(rewritten, ScoreMode.TOP_SCORES, 1f);

Review Comment:
   Thanks for the review. I've simplified the test as suggested. Please take 
another look in your spare time.



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

Reply via email to