Package org.apache.lucene.sandbox.index

## Class MergeOnFlushMergePolicy

- java.lang.Object
- - org.apache.lucene.index.MergePolicy
  - - org.apache.lucene.index.FilterMergePolicy
    - - org.apache.lucene.sandbox.index.MergeOnFlushMergePolicy

- All Implemented Interfaces:
    `Unwrappable<MergePolicy>`

      public class MergeOnFlushMergePolicy
      extends FilterMergePolicy

  A simple extension to wrap `MergePolicy` to merge all tiny segments (or at least segments smaller than specified in `setSmallSegmentThresholdMB(double)` into one segment on commit.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.lucene.index.MergePolicy

      `MergePolicy.MergeAbortedException, MergePolicy.MergeContext, MergePolicy.MergeException, MergePolicy.MergeSpecification, MergePolicy.OneMerge, MergePolicy.OneMergeProgress`

  - ### Field Summary

    - ### Fields inherited from class org.apache.lucene.index.FilterMergePolicy

      `in`

    - ### Fields inherited from class org.apache.lucene.index.MergePolicy

      `DEFAULT_MAX_CFS_SEGMENT_SIZE, DEFAULT_NO_CFS_RATIO, maxCFSSegmentSize, noCFSRatio`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `MergeOnFlushMergePolicy​(MergePolicy mergePolicy)` | Creates a MergeOnFlushMergePolicy merge policy instance wrapping another.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `MergePolicy.MergeSpecification` | `findFullFlushMerges​(MergeTrigger mergeTrigger, SegmentInfos segmentInfos, MergePolicy.MergeContext mergeContext)` |
    `double` | `getSmallSegmentThresholdMB()` |
    `void` | `setSmallSegmentThresholdMB​(double smallSegmentThresholdMB)` |

    - ### Methods inherited from class org.apache.lucene.index.FilterMergePolicy

      `findForcedDeletesMerges, findForcedMerges, findMerges, findMerges, getMaxCFSSegmentSizeMB, getNoCFSRatio, keepFullyDeletedSegment, maxFullFlushMergeSize, numDeletesToMerge, setMaxCFSSegmentSizeMB, setNoCFSRatio, size, toString, unwrap, useCompoundFile`

    - ### Methods inherited from class org.apache.lucene.index.MergePolicy

      `assertDelCount, isMerged, message, segString, verbose`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### MergeOnFlushMergePolicy

          public MergeOnFlushMergePolicy​(MergePolicy mergePolicy)

      Creates a MergeOnFlushMergePolicy merge policy instance wrapping another.
      Parameters:
        `mergePolicy` - the wrapped `MergePolicy`

  - ### Method Detail

    - #### getSmallSegmentThresholdMB

          public double getSmallSegmentThresholdMB()

    - #### setSmallSegmentThresholdMB

          public void setSmallSegmentThresholdMB​(double smallSegmentThresholdMB)

      Parameters:
        `smallSegmentThresholdMB` - all segments smaller than this will be merged into a single segment before commit completes.

    - #### findFullFlushMerges

          public MergePolicy.MergeSpecification findFullFlushMerges​(MergeTrigger mergeTrigger,
                                                                    SegmentInfos segmentInfos,
                                                                    MergePolicy.MergeContext mergeContext)
                                                             throws IOException

      Overrides:
        `findFullFlushMerges` in class `FilterMergePolicy`
      Throws:
        `IOException`