vsop-479 commented on code in PR #13398: URL: https://github.com/apache/lucene/pull/13398#discussion_r1611318109
########## lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java: ########## @@ -202,6 +183,89 @@ public boolean keepFullyDeletedSegment( dir.close(); } + public void testDeleteByQueries() throws IOException { + Directory dir = newDirectory(); + IndexWriter writer = + new IndexWriter( + dir, + new IndexWriterConfig(new MockAnalyzer(random())) + .setMergePolicy(NoMergePolicy.INSTANCE)); + + Document doc; + for (int i = 0; i < 10; i++) { + doc = new Document(); + doc.add(new LongField("content", i, Field.Store.NO)); + writer.addDocument(doc); + } + writer.flush(); + + for (int i = 10; i < 20; i++) { + doc = new Document(); + doc.add(new LongField("content", i, Field.Store.NO)); + writer.addDocument(doc); + } + writer.flush(); + + for (int i = 20; i < 30; i++) { + doc = new Document(); + doc.add(new LongField("content", i, Field.Store.NO)); + writer.addDocument(doc); + } + writer.flush(); + writer.deleteDocuments( Review Comment: > is this code really executing the new early break? Yes, i added two queries in `deleteDocuments`. First query: [10, 19] will match all docs in 2nd segment, and result in 2nd segment `FullyDeleted`. Second query: [12, 15] will tickle the new early-break code. -- 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