Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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

    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.

Nested Class Summary
`static class` | `BalancedSegmentMergePolicy.MergePolicyParams` 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`

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()`

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

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

See Also:
  Constant Field Values

Constructor Detail

### BalancedSegmentMergePolicy

    public BalancedSegmentMergePolicy()

Method Detail

### setMergePolicyParams

    public void setMergePolicyParams(BalancedSegmentMergePolicy.MergePolicyParams params)

### size

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

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

### setPartialExpunge

    public void setPartialExpunge(boolean doPartialExpunge)

### getPartialExpunge

    public boolean getPartialExpunge()

### setNumLargeSegments

    public void setNumLargeSegments(int numLargeSegments)

### getNumLargeSegments

    public int getNumLargeSegments()

### setMaxSmallSegments

    public void setMaxSmallSegments(int maxSmallSegments)

### getMaxSmallSegments

    public int getMaxSmallSegments()

### setMergeFactor

    public void setMergeFactor(int mergeFactor)

  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

  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

  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

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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD