Index: lucene/src/java/org/apache/lucene/index/LogMergePolicy.java =================================================================== --- lucene/src/java/org/apache/lucene/index/LogMergePolicy.java (revision 1067025) +++ lucene/src/java/org/apache/lucene/index/LogMergePolicy.java (working copy) @@ -18,9 +18,12 @@ */ import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; import java.util.Set; -import java.util.Arrays; -import java.util.Comparator; /**

This class implements a {@link MergePolicy} that tries * to merge segments into levels of exponentially @@ -474,7 +477,7 @@ return spec; } - private static class SegmentInfoAndLevel implements Comparable { + private static class SegmentInfoAndLevel implements Comparable { SegmentInfo info; float level; int index; @@ -486,8 +489,7 @@ } // Sorts largest to smallest - public int compareTo(Object o) { - SegmentInfoAndLevel other = (SegmentInfoAndLevel) o; + public int compareTo(SegmentInfoAndLevel other) { if (level < other.level) return 1; else if (level > other.level) @@ -521,22 +523,37 @@ // Compute levels, which is just log (base mergeFactor) // of the size of each segment - SegmentInfoAndLevel[] levels = new SegmentInfoAndLevel[numSegments]; + final List levels = new ArrayList(); final float norm = (float) Math.log(mergeFactor); + final Collection mergingSegments = writer.get().getMergingSegments(); + for(int i=0;iDo not alter the returned collection! */ + public synchronized Collection getMergingSegments() { + return mergingSegments; + } + /** Expert: the {@link MergeScheduler} calls this method * to retrieve the next merge requested by the * MergePolicy */