org.apache.lucene.index

## Class LogByteSizeMergePolicy

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

-     public class LogByteSizeMergePolicy
      extends LogMergePolicy

  This is a `LogMergePolicy` that measures size of a segment as the total byte size of the segment's files.

- - ### 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 double` | `DEFAULT_MAX_MERGE_MB` Default maximum segment size.
    `static double` | `DEFAULT_MIN_MERGE_MB` 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
    `LogByteSizeMergePolicy(IndexWriter writer)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `double` | `getMaxMergeMB()` Returns the largest segment (measured by total byte size of the segment's files, in MB) that may be merged with other segments.
    `double` | `getMinMergeMB()` Get the minimum size for a segment to remain un-merged.
    `void` | `setMaxMergeMB(double mb)` Determines the largest segment (measured by total byte size of the segment's files, in MB) that may be merged with other segments.
    `void` | `setMinMergeMB(double mb)` 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_MB

          public static final double DEFAULT_MIN_MERGE_MB

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

    - #### DEFAULT_MAX_MERGE_MB

          public static final double DEFAULT_MAX_MERGE_MB

      Default maximum segment size. A segment of this size or larger will never be merged. @see setMaxMergeMB
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### LogByteSizeMergePolicy

          public LogByteSizeMergePolicy(IndexWriter writer)

  - ### Method Detail

    - #### size

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

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

    - #### setMaxMergeMB

          public void setMaxMergeMB(double mb)

      Determines the largest segment (measured by total byte size of the segment's files, in MB) that may be merged with other segments. Small values (e.g., less than 50 MB) are best for interactive indexing, as this limits the length of pauses while indexing to a few seconds. Larger values are best for batched indexing and speedier searches.

      Note that `LogMergePolicy.setMaxMergeDocs(int)` is also used to check whether a segment is too large for merging (it's either or).

    - #### getMaxMergeMB

          public double getMaxMergeMB()

      Returns the largest segment (measured by total byte size of the segment's files, in MB) that may be merged with other segments.
      See Also:
        `setMaxMergeMB(double)`

    - #### setMinMergeMB

          public void setMinMergeMB(double mb)

      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).

    - #### getMinMergeMB

          public double getMinMergeMB()

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

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