vsop-479 commented on code in PR #13398: URL: https://github.com/apache/lucene/pull/13398#discussion_r1611335102
########## 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: By the way, maybe we can sort the queries(seperate PR?), to let the big range query executed first, so the segment can `FullyDeleted` early. -- 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