Class LogDocMergePolicy

  extended by org.apache.lucene.index.MergePolicy
      extended by org.apache.lucene.index.LogMergePolicy
          extended by org.apache.lucene.index.LogDocMergePolicy
All Implemented Interfaces:
Closeable, Cloneable

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.MergeTrigger, MergePolicy.OneMerge
Field Summary
          Default minimum segment size.
Fields inherited from class org.apache.lucene.index.LogMergePolicy
calibrateSizeByDeletes, DEFAULT_MAX_CFS_SEGMENT_SIZE, DEFAULT_MAX_MERGE_DOCS, DEFAULT_MERGE_FACTOR, DEFAULT_NO_CFS_RATIO, LEVEL_LOG_SPAN, maxCFSSegmentSize, maxMergeDocs, maxMergeSize, maxMergeSizeForForcedMerge, mergeFactor, minMergeSize, noCFSRatio, useCompoundFile
Fields inherited from class org.apache.lucene.index.MergePolicy
Constructor Summary
          Sole constructor, setting all settings to their defaults.
Method Summary
 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(SegmentInfoPerCommit info)
          Return the size of the provided SegmentInfoPerCommit.
Methods inherited from class org.apache.lucene.index.LogMergePolicy
close, findForcedDeletesMerges, findForcedMerges, findMerges, getCalibrateSizeByDeletes, getMaxCFSSegmentSizeMB, getMaxMergeDocs, getMergeFactor, getNoCFSRatio, getUseCompoundFile, isMerged, isMerged, message, setCalibrateSizeByDeletes, setMaxCFSSegmentSizeMB, setMaxMergeDocs, setMergeFactor, setNoCFSRatio, setUseCompoundFile, sizeBytes, sizeDocs, toString, useCompoundFile, verbose
Methods inherited from class org.apache.lucene.index.MergePolicy
clone, setIndexWriter
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail


public static final int DEFAULT_MIN_MERGE_DOCS
Default minimum segment size. @see setMinMergeDocs

See Also:
Constant Field Values
Constructor Detail


public LogDocMergePolicy()
Sole constructor, setting all settings to their defaults.

Method Detail


protected long size(SegmentInfoPerCommit info)
             throws IOException
Description copied from class: LogMergePolicy
Return the size of the provided SegmentInfoPerCommit.

Specified by:
size in class LogMergePolicy


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


public int getMinMergeDocs()
Get the minimum size for a segment to remain un-merged.

See Also:

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