## org.apache.lucene.index
Class BalancedSegmentMergePolicy

    java.lang.Object
      org.apache.lucene.index.MergePolicy
          org.apache.lucene.index.LogMergePolicy
              org.apache.lucene.index.LogByteSizeMergePolicy
                  org.apache.lucene.index.BalancedSegmentMergePolicy

All Implemented Interfaces:
  Closeable

Deprecated. This class is removed in 4.0; use `TieredMergePolicy` instead.

    @Deprecated
    public class BalancedSegmentMergePolicy

extends org.apache.lucene.index.LogByteSizeMergePolicy

Merge policy that tries to balance not doing large segment merges with not accumulating too many segments in the index, to provide for better performance in near real-time setting.

This is based on code from zoie, described in more detail at http://code.google.com/p/zoie/wiki/ZoieMergePolicy.

WARNING: there is a known bug in this merge policy that causes it to run forever, merging the same single segment over and over. If you use `SerialMergeScheduler` this can cause an index thread to hang forever merging. See LUCENE-4269 for details.

Nested Class Summary
`static class` `BalancedSegmentMergePolicy.MergePolicyParams` Deprecated. Specifies configuration parameters for BalancedSegmentMergePolicy.

Nested classes/interfaces inherited from class org.apache.lucene.index.MergePolicy
`org.apache.lucene.index.MergePolicy.MergeAbortedException, org.apache.lucene.index.MergePolicy.MergeException, org.apache.lucene.index.MergePolicy.MergeSpecification, org.apache.lucene.index.MergePolicy.OneMerge`

Field Summary
`static int` `DEFAULT_NUM_LARGE_SEGMENTS` Deprecated.

Fields inherited from class org.apache.lucene.index.LogByteSizeMergePolicy
`DEFAULT_MAX_MERGE_MB, DEFAULT_MAX_MERGE_MB_FOR_FORCED_MERGE, DEFAULT_MIN_MERGE_MB`

Fields inherited from class org.apache.lucene.index.LogMergePolicy
`calibrateSizeByDeletes, DEFAULT_MAX_MERGE_DOCS, DEFAULT_MERGE_FACTOR, DEFAULT_NO_CFS_RATIO, LEVEL_LOG_SPAN, maxMergeDocs, maxMergeSize, maxMergeSizeForForcedMerge, mergeFactor, minMergeSize, noCFSRatio, useCompoundFile`

Fields inherited from class org.apache.lucene.index.MergePolicy
`writer`

Constructor Summary
`BalancedSegmentMergePolicy()` Deprecated.

Method Summary
`org.apache.lucene.index.MergePolicy.MergeSpecification` `findForcedDeletesMerges(org.apache.lucene.index.SegmentInfos infos)` Deprecated.
`org.apache.lucene.index.MergePolicy.MergeSpecification` `findForcedMerges(org.apache.lucene.index.SegmentInfos infos, int maxNumSegments, Map<org.apache.lucene.index.SegmentInfo,Boolean> segmentsToMerge)` Deprecated.
`org.apache.lucene.index.MergePolicy.MergeSpecification` `findMerges(org.apache.lucene.index.SegmentInfos infos)` Deprecated.
`int` `getMaxSmallSegments()` Deprecated.
`int` `getNumLargeSegments()` Deprecated.
`boolean` `getPartialExpunge()` Deprecated.
`void` `setMaxSmallSegments(int maxSmallSegments)` Deprecated.
`void` `setMergeFactor(int mergeFactor)` Deprecated.
`void` `setMergePolicyParams(BalancedSegmentMergePolicy.MergePolicyParams params)` Deprecated.
`void` `setNumLargeSegments(int numLargeSegments)` Deprecated.
`void` `setPartialExpunge(boolean doPartialExpunge)` Deprecated.
`protected long` `size(org.apache.lucene.index.SegmentInfo info)` Deprecated.

Methods inherited from class org.apache.lucene.index.LogByteSizeMergePolicy
`getMaxMergeMB, getMaxMergeMBForForcedMerge, getMaxMergeMBForOptimize, getMinMergeMB, setMaxMergeMB, setMaxMergeMBForForcedMerge, setMaxMergeMBForOptimize, setMinMergeMB`

Methods inherited from class org.apache.lucene.index.LogMergePolicy
`close, getCalibrateSizeByDeletes, getMaxMergeDocs, getMergeFactor, getNoCFSRatio, getUseCompoundFile, isMerged, isMerged, message, setCalibrateSizeByDeletes, setMaxMergeDocs, setNoCFSRatio, setUseCompoundFile, sizeBytes, sizeDocs, toString, useCompoundFile, verbose`

Methods inherited from class org.apache.lucene.index.MergePolicy
`setIndexWriter`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### DEFAULT_NUM_LARGE_SEGMENTS

    public static final int DEFAULT_NUM_LARGE_SEGMENTS

  Deprecated.
  See Also:
    Constant Field Values

Constructor Detail

### BalancedSegmentMergePolicy

    public BalancedSegmentMergePolicy()

  Deprecated.

Method Detail

### setMergePolicyParams

    public void setMergePolicyParams(BalancedSegmentMergePolicy.MergePolicyParams params)

  Deprecated.

### size

    protected long size(org.apache.lucene.index.SegmentInfo info)
                 throws IOException

  Deprecated.
  Overrides:
    `size` in class `org.apache.lucene.index.LogByteSizeMergePolicy`
  Throws:
    `IOException`

### setPartialExpunge

    public void setPartialExpunge(boolean doPartialExpunge)

  Deprecated.

### getPartialExpunge

    public boolean getPartialExpunge()

  Deprecated.

### setNumLargeSegments

    public void setNumLargeSegments(int numLargeSegments)

  Deprecated.

### getNumLargeSegments

    public int getNumLargeSegments()

  Deprecated.

### setMaxSmallSegments

    public void setMaxSmallSegments(int maxSmallSegments)

  Deprecated.

### getMaxSmallSegments

    public int getMaxSmallSegments()

  Deprecated.

### setMergeFactor

    public void setMergeFactor(int mergeFactor)

  Deprecated.
  Overrides:
    `setMergeFactor` in class `org.apache.lucene.index.LogMergePolicy`

### findForcedMerges

    public org.apache.lucene.index.MergePolicy.MergeSpecification findForcedMerges(org.apache.lucene.index.SegmentInfos infos,
                                                                                   int maxNumSegments,
                                                                                   Map<org.apache.lucene.index.SegmentInfo,Boolean> segmentsToMerge)
                                                                            throws IOException

  Deprecated.
  Overrides:
    `findForcedMerges` in class `org.apache.lucene.index.LogMergePolicy`
  Throws:
    `IOException`

### findForcedDeletesMerges

    public org.apache.lucene.index.MergePolicy.MergeSpecification findForcedDeletesMerges(org.apache.lucene.index.SegmentInfos infos)
                                                                                   throws org.apache.lucene.index.CorruptIndexException,
                                                                                          IOException

  Deprecated.
  Overrides:
    `findForcedDeletesMerges` in class `org.apache.lucene.index.LogMergePolicy`
  Throws:
    `org.apache.lucene.index.CorruptIndexException`
    `IOException`

### findMerges

    public org.apache.lucene.index.MergePolicy.MergeSpecification findMerges(org.apache.lucene.index.SegmentInfos infos)
                                                                      throws IOException

  Deprecated.
  Overrides:
    `findMerges` in class `org.apache.lucene.index.LogMergePolicy`
  Throws:
    `IOException`