dweiss commented on code in PR #15120:
URL: https://github.com/apache/lucene/pull/15120#discussion_r2299847152
##########
lucene/core/src/test/org/apache/lucene/index/TestIndexWriterMerging.java:
##########
@@ -461,4 +461,33 @@ public void run() {
directory.close();
}
+
+ public void testAddEstimatedBytesToMerge() throws IOException {
+ Directory dir = newDirectory();
+ IndexWriter writer =
+ new IndexWriter(
+ dir,
+ newIndexWriterConfig(new MockAnalyzer(random()))
+ .setMergePolicy(NoMergePolicy.INSTANCE));
+
+ Document doc = new Document();
+ doc.add(newTextField("field", "content", Field.Store.YES));
+ for (int i = 0; i < 10; i++) {
+ writer.addDocument(doc);
+ }
+ writer.flush();
+
+ // Create a merge with the segments
+ SegmentInfos segmentInfos = writer.cloneSegmentInfos();
+ MergePolicy.OneMerge merge = new
MergePolicy.OneMerge(segmentInfos.asList());
+
+ writer.addEstimatedBytesToMerge(merge);
+
+ assertTrue(merge.estimatedMergeBytes > 0);
+ assertTrue(merge.totalMergeBytes > 0);
+ assertTrue(merge.estimatedMergeBytes <= merge.totalMergeBytes);
+
+ writer.close();
+ dir.close();
Review Comment:
The project has 20+ years of history, this isn't surprising. I think we
should fix these when we touch the code involved - one huge patch is probably
not worth the effort here. New code should stick to new conventions (and
utilities) available in the language.
--
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]