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.MergeException, MergePolicy.MergeSpecification, MergePolicy.OneMerge`

  - ### Field Summary

    Fields
    Modifier and Type | Field and 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, noCFSRatio`

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

      `writer`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LogDocMergePolicy(IndexWriter writer)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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(SegmentInfo info)`

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

      `close, findMerges, findMergesForOptimize, findMergesToExpungeDeletes, getCalibrateSizeByDeletes, getMaxMergeDocs, getMergeFactor, getNoCFSRatio, getUseCompoundDocStore, getUseCompoundFile, makeOneMerge, setCalibrateSizeByDeletes, setMaxMergeDocs, setMergeFactor, setNoCFSRatio, setUseCompoundDocStore, setUseCompoundFile, sizeBytes, sizeDocs, useCompoundDocStore, useCompoundFile, verbose`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, 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(IndexWriter writer)

  - ### Method Detail

    - #### size

          protected long size(SegmentInfo info)
                       throws java.io.IOException

      Specified by:
        `size` in class `LogMergePolicy`
      Throws:
        `java.io.IOException`

    - #### setMinMergeDocs

          public void setMinMergeDocs(int minMergeDocs)

      Sets the minimum size for the lowest level segments. Any segments below this size are considered to be on the same level (even if they vary drastically in size) and will be merged whenever there are mergeFactor of them. This effectively truncates the "long tail" of small segments that would otherwise be created into a single level. If you set this too large, it could greatly increase the merging cost during indexing (if you flush many small segments).

    - #### getMinMergeDocs

          public int getMinMergeDocs()

      Get the minimum size for a segment to remain un-merged.
      See Also:
        `setMinMergeDocs(int)`

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.