jtibshirani commented on a change in pull request #677:
URL: https://github.com/apache/lucene/pull/677#discussion_r807297322



##########
File path: 
lucene/core/src/test/org/apache/lucene/search/TestDocValuesFieldExistsQuery.java
##########
@@ -38,6 +39,100 @@
 
 public class TestDocValuesFieldExistsQuery extends LuceneTestCase {
 
+  public void testRewriteWithTermsPresent() throws IOException {
+    Directory dir = newDirectory();
+    RandomIndexWriter iw = new RandomIndexWriter(random(), dir);
+    final int numDocs = atLeast(100);
+    for (int i = 0; i < numDocs; ++i) {
+      Document doc = new Document();
+      doc.add(new StringField("f", random().nextBoolean() ? "yes" : "no", 
Store.NO));
+      iw.addDocument(doc);
+    }
+    iw.commit();
+    final IndexReader reader = iw.getReader();
+    final IndexSearcher searcher = newSearcher(reader);
+    iw.close();
+
+    Query query = new DocValuesFieldExistsQuery("f");
+    Query rewrittenQuery = query.rewrite(reader);
+    assertTrue(rewrittenQuery instanceof MatchAllDocsQuery);
+    assertSameMatches(searcher, query, rewrittenQuery, false);

Review comment:
       I think we can skip these `assertSameMatches`, because we always rewrite 
the query as part of the search. So it is not asserting anything insightful 
about `DocValuesFieldExistsQuery`.




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