gautamworah96 commented on a change in pull request #242: URL: https://github.com/apache/lucene/pull/242#discussion_r701468588
########## File path: lucene/core/src/test/org/apache/lucene/search/TestTermQuery.java ########## @@ -103,6 +103,39 @@ public void testCreateWeightDoesNotSeekIfScoresAreNotNeeded() throws IOException IOUtils.close(reader, w, dir); } + // LUCENE-9620 Add Weight#count(LeafReaderContext) + public void testQueryMatchesCount() throws IOException { + Directory dir = newDirectory(); + RandomIndexWriter w = new RandomIndexWriter(random(), dir); + + int randomNumDocs = random().nextInt(500); + int numMatchingDocs = 0; + + for (int i = 0; i < randomNumDocs; i++) { + Document doc = new Document(); + if (random().nextBoolean()) { + doc.add(new StringField("foo", "bar", Store.NO)); + numMatchingDocs++; + } + w.addDocument(doc); + if (random().nextBoolean()) { + w.commit(); Review comment: Ahh. Copied it over from another test. -- 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