Class MergePolicy
Expert: a MergePolicy determines the sequence of primitive merge operations.
Whenever the segments in an index have been altered by IndexWriter, either the addition of a newly flushed segment, addition of many segments from AddIndexes* calls, or a previous merge that may now need to cascade, IndexWriter invokes FindMerges(MergeTrigger, SegmentInfos) to give the MergePolicy a chance to pick merges that are now required. This method returns a MergePolicy.MergeSpecification instance describing the set of merges that should be done, or null if no merges are necessary. When ForceMerge(Int32) is called, it calls FindForcedMerges(SegmentInfos, Int32, IDictionary<SegmentCommitInfo, Nullable<Boolean>>) and the MergePolicy should then return the necessary merges.
Note that the policy can return more than one merge at a time. In this case, if the writer is using SerialMergeScheduler, the merges will be run sequentially but if it is using ConcurrentMergeScheduler they will be run concurrently.
The default MergePolicy is TieredMergePolicy.
@lucene.experimental
Inheritance
Assembly: DistributedLucene.Net.dll
Syntax
public abstract class MergePolicy : IDisposable
Constructors
Name | Description |
---|---|
MergePolicy() | Creates a new merge policy instance. Note that if you intend to use it without passing it to IndexWriter, you should call SetIndexWriter(IndexWriter). |
MergePolicy(Double, Int64) | Creates a new merge policy instance with default settings for m_noCFSRatio and m_maxCFSSegmentSize. This ctor should be used by subclasses using different defaults than the MergePolicy |
Fields
Name | Description |
---|---|
DEFAULT_MAX_CFS_SEGMENT_SIZE | Default max segment size in order to use compound file system. Set to |
DEFAULT_NO_CFS_RATIO | Default ratio for compound file system usage. Set to |
m_maxCFSSegmentSize | If the size of the merged segment exceeds this value then it will not use compound file format. |
m_noCFSRatio | If the size of the merge segment exceeds this ratio of the total index size then it will remain in non-compound format |
m_writer | IndexWriter that contains this instance. |
Properties
Name | Description |
---|---|
MaxCFSSegmentSizeMB | Gets or Sets the largest size allowed for a compound file segment.
If a merged segment will be more than this value,
leave the segment as
non-compound file even if compound file is enabled.
Set this to |
NoCFSRatio | Gets or Sets current m_noCFSRatio. If a merged segment will be more than this percentage of the total size of the index, leave the segment as non-compound file even if compound file is enabled. Set to 1.0 to always use CFS regardless of merge size. |
Methods
Name | Description |
---|---|
Clone() | |
Dispose() | Release all resources for the policy. |
Dispose(Boolean) | Release all resources for the policy. |
FindForcedDeletesMerges(SegmentInfos) | Determine what set of merge operations is necessary in order to expunge all deletes from the index. |
FindForcedMerges(SegmentInfos, Int32, IDictionary<SegmentCommitInfo, Nullable<Boolean>>) | Determine what set of merge operations is necessary in order to merge to <= the specified segment count. IndexWriter calls this when its ForceMerge(Int32, Boolean) method is called. This call is always synchronized on the IndexWriter instance so only one thread at a time will call this method. |
FindMerges(MergeTrigger, SegmentInfos) | Determine what set of merge operations are now necessary on the index. IndexWriter calls this whenever there is a change to the segments. This call is always synchronized on the IndexWriter instance so only one thread at a time will call this method. |
IsMerged(SegmentInfos, SegmentCommitInfo) | Returns |
SetIndexWriter(IndexWriter) | Sets the IndexWriter to use by this merge policy. This method is allowed to be called only once, and is usually set by IndexWriter. If it is called more than once, AlreadySetException is thrown. |
Size(SegmentCommitInfo) | Return the byte size of the provided SegmentCommitInfo, pro-rated by percentage of non-deleted documents is set. |
UseCompoundFile(SegmentInfos, SegmentCommitInfo) | Returns .
|