Class LogMergePolicy
This class implements a MergePolicy that tries to merge segments into levels of exponentially increasing size, where each level has fewer segments than the value of the merge factor. Whenever extra segments (beyond the merge factor upper bound) are encountered, all segments within the level are merged. You can get or set the merge factor using MergeFactor.
This class is abstract and requires a subclass to define the Size(SegmentCommitInfo) method which specifies how a segment's size is determined. LogDocMergePolicy is one subclass that measures size by document count in the segment. LogByteSizeMergePolicy is another subclass that measures size as the total byte size of the file(s) for the segment.
Inherited Members
Assembly: DistributedLucene.Net.dll
Syntax
public abstract class LogMergePolicy : MergePolicy
Constructors
Name | Description |
---|---|
LogMergePolicy() | Sole constructor. (For invocation by subclass constructors, typically implicit.) |
Fields
Name | Description |
---|---|
DEFAULT_MAX_MERGE_DOCS | Default maximum segment size. A segment of this size or larger will never be merged. |
DEFAULT_MERGE_FACTOR | Default merge factor, which is how many segments are merged at a time |
DEFAULT_NO_CFS_RATIO | Default noCFSRatio. If a merge's size is >= 10% of the index, then we disable compound file for it. |
LEVEL_LOG_SPAN | Defines the allowed range of log(size) for each level. A level is computed by taking the max segment log size, minus LEVEL_LOG_SPAN, and finding all segments falling within that range. |
m_calibrateSizeByDeletes | If true, we pro-rate a segment's size by the percentage of non-deleted documents. |
m_maxMergeDocs | If a segment has more than this many documents then it will never be merged. |
m_maxMergeSize | If the size of a segment exceeds this value then it will never be merged. |
m_maxMergeSizeForForcedMerge | If the size of a segment exceeds this value then it will never be merged during ForceMerge(Int32). |
m_mergeFactor | How many segments to merge at a time. |
m_minMergeSize | Any segments whose size is smaller than this value will be rounded up to this value. This ensures that tiny segments are aggressively merged. |
Properties
Name | Description |
---|---|
CalibrateSizeByDeletes | Gets or Sets whether the segment size should be calibrated by the number of deletes when choosing segments for merge. |
IsVerbose | Returns true if LogMergePolicy is enabled in Lucene.Net.Index.IndexWriter.infoStream. |
MaxMergeDocs | Determines the largest segment (measured by document count) that may be merged with other segments. Small values (e.g., less than 10,000) 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. The default value is The default merge policy (LogByteSizeMergePolicy) also allows you to set this limit by net size (in MB) of the segment, using MaxMergeMB. |
MergeFactor | Gets or Sets the number of segments that are merged at once and also controls the total number of segments allowed to accumulate in the index. This determines how often segment indices are merged by AddDocument(IEnumerable<IIndexableField>). With smaller values, less RAM is used while indexing, and searches are faster, but indexing speed is slower. With larger values, more RAM is used during indexing, and while searches is slower, indexing is faster. Thus larger values (> 10) are best for batch index creation, and smaller values (< 10) for indices that are interactively maintained. |
Methods
Name | Description |
---|---|
Dispose(Boolean) | |
FindForcedDeletesMerges(SegmentInfos) | Finds merges necessary to force-merge all deletes from the index. We simply merge adjacent segments that have deletes, up to mergeFactor at a time. |
FindForcedMerges(SegmentInfos, Int32, IDictionary<SegmentCommitInfo, Nullable<Boolean>>) | Returns the merges necessary to merge the index down
to a specified number of segments.
this respects the m_maxMergeSizeForForcedMerge setting.
By default, and assuming |
FindMerges(MergeTrigger, SegmentInfos) | Checks if any merges are now necessary and returns a MergePolicy.MergeSpecification if so. A merge is necessary when there are more than MergeFactor segments at a given level. When multiple levels have too many segments, this method will return multiple merges, allowing the MergeScheduler to use concurrency. |
IsMerged(SegmentInfos, Int32, IDictionary<SegmentCommitInfo, Nullable<Boolean>>) | Returns |
Message(String) | Print a debug message to Lucene.Net.Index.IndexWriter.infoStream. |
SizeBytes(SegmentCommitInfo) | Return the byte size of the provided SegmentCommitInfo, pro-rated by percentage of non-deleted documents if CalibrateSizeByDeletes is set. |
SizeDocs(SegmentCommitInfo) | Return the number of documents in the provided SegmentCommitInfo, pro-rated by percentage of non-deleted documents if CalibrateSizeByDeletes is set. |
ToString() |