Package org.apache.lucene.index

## Class LogDocMergePolicy

- java.lang.Object
- - org.apache.lucene.index.MergePolicy
  - - org.apache.lucene.index.LogMergePolicy
    - - org.apache.lucene.index.LogDocMergePolicy

-     public class LogDocMergePolicy
      extends LogMergePolicy

  This is a `LogMergePolicy` that measures size of a segment as the number of documents (not taking deletions into account).

- - ### 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
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `DEFAULT_MIN_MERGE_DOCS` | Default minimum segment size.

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

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

      `DEFAULT_MAX_CFS_SEGMENT_SIZE, maxCFSSegmentSize, noCFSRatio`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `LogDocMergePolicy()` | Sole constructor, setting all settings to their defaults.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `getMinMergeDocs()` | Get the minimum size for a segment to remain un-merged.
    `void` | `setMinMergeDocs​(int minMergeDocs)` | Sets the minimum size for the lowest level segments.
    `protected long` | `size​(SegmentCommitInfo info, MergePolicy.MergeContext mergeContext)` | Return the byte size of the provided `SegmentCommitInfo`, pro-rated by percentage of non-deleted documents is set.

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

      `findForcedDeletesMerges, findForcedMerges, findMerges, getCalibrateSizeByDeletes, getMaxMergeDocs, getMergeFactor, isMerged, maxFullFlushMergeSize, setCalibrateSizeByDeletes, setMaxMergeDocs, setMergeFactor, sizeBytes, sizeDocs, toString`

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

      `assertDelCount, findFullFlushMerges, findMerges, getMaxCFSSegmentSizeMB, getNoCFSRatio, isMerged, keepFullyDeletedSegment, message, numDeletesToMerge, segString, setMaxCFSSegmentSizeMB, setNoCFSRatio, useCompoundFile, verbose`

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

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

- - ### Field Detail

    - #### DEFAULT_MIN_MERGE_DOCS

          public static final int DEFAULT_MIN_MERGE_DOCS

      Default minimum segment size. @see setMinMergeDocs
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### LogDocMergePolicy

          public LogDocMergePolicy()

      Sole constructor, setting all settings to their defaults.

  - ### Method Detail

    - #### size

          protected long size​(SegmentCommitInfo info,
                              MergePolicy.MergeContext mergeContext)
                       throws IOException

      Description copied from class: `MergePolicy`
      Return the byte size of the provided `SegmentCommitInfo`, pro-rated by percentage of non-deleted documents is set.
      Overrides:
        `size` in class `MergePolicy`
      Throws:
        `IOException`

    - #### setMinMergeDocs

          public void setMinMergeDocs​(int minMergeDocs)

      Sets the minimum size for the lowest level segments. Any segments below this size are candidates for full-flush merges and merged more aggressively in order to avoid having a long tail of small segments. Large values of this parameter increase the merging cost during indexing if you flush small segments.

    - #### getMinMergeDocs

          public int getMinMergeDocs()

      Get the minimum size for a segment to remain un-merged.
      See Also:
        `*`