Class MergePolicy
Expert: a Merge
Whenever the segments in an index have been altered by
Index
Note that the policy can return more than one merge at
a time. In this case, if the writer is using
Serial
The default MergePolicy is
Tiered
Inheritance
Namespace: Lucene.Net.Index
Assembly: Lucene.Net.dll
Syntax
public abstract class MergePolicy : IDisposable
Constructors
| Improve this Doc View SourceMergePolicy()
Creates a new merge policy instance. Note that if you intend to use it
without passing it to Index
Declaration
public MergePolicy()
MergePolicy(Double, Int64)
Creates a new merge policy instance with default settings for m_no
Declaration
protected MergePolicy(double defaultNoCFSRatio, long defaultMaxCFSSegmentSize)
Parameters
Type | Name | Description |
---|---|---|
System. |
defaultNoCFSRatio | |
System. |
defaultMaxCFSSegmentSize |
Fields
| Improve this Doc View SourceDEFAULT_MAX_CFS_SEGMENT_SIZE
Default max segment size in order to use compound file system. Set to
Declaration
protected static readonly long DEFAULT_MAX_CFS_SEGMENT_SIZE
Field Value
Type | Description |
---|---|
System. |
DEFAULT_NO_CFS_RATIO
Default ratio for compound file system usage. Set to 1.0
, always use
compound file system.
Declaration
protected static readonly double DEFAULT_NO_CFS_RATIO
Field Value
Type | Description |
---|---|
System. |
m_maxCFSSegmentSize
If the size of the merged segment exceeds this value then it will not use compound file format.
Declaration
protected long m_maxCFSSegmentSize
Field Value
Type | Description |
---|---|
System. |
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
Declaration
protected double m_noCFSRatio
Field Value
Type | Description |
---|---|
System. |
m_writer
Index
Declaration
protected SetOnce<IndexWriter> m_writer
Field Value
Type | Description |
---|---|
Set |
Properties
| Improve this Doc View SourceMaxCFSSegmentSizeMB
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
Declaration
public double MaxCFSSegmentSizeMB { get; set; }
Property Value
Type | Description |
---|---|
System. |
NoCFSRatio
Gets or Sets current m_no
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.
Declaration
public double NoCFSRatio { get; set; }
Property Value
Type | Description |
---|---|
System. |
Methods
| Improve this Doc View SourceClone()
Declaration
public virtual object Clone()
Returns
Type | Description |
---|---|
System. |
Dispose()
Release all resources for the policy.
Declaration
public void Dispose()
Dispose(Boolean)
Release all resources for the policy.
Declaration
protected abstract void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System. |
disposing |
FindForcedDeletesMerges(SegmentInfos)
Determine what set of merge operations is necessary in order to expunge all deletes from the index.
Declaration
public abstract MergePolicy.MergeSpecification FindForcedDeletesMerges(SegmentInfos segmentInfos)
Parameters
Type | Name | Description |
---|---|---|
Segment |
segmentInfos | the total set of segments in the index |
Returns
Type | Description |
---|---|
Merge |
FindForcedMerges(SegmentInfos, Int32, IDictionary<SegmentCommitInfo, Nullable<Boolean>>)
Determine what set of merge operations is necessary in
order to merge to <= the specified segment count. Index
Declaration
public abstract MergePolicy.MergeSpecification FindForcedMerges(SegmentInfos segmentInfos, int maxSegmentCount, IDictionary<SegmentCommitInfo, bool?> segmentsToMerge)
Parameters
Type | Name | Description |
---|---|---|
Segment |
segmentInfos | The total set of segments in the index |
System. |
maxSegmentCount | Requested maximum number of segments in the index (currently this is always 1) |
IDictionary<Segment |
segmentsToMerge | Contains the specific Segment |
Returns
Type | Description |
---|---|
Merge |
FindMerges(MergeTrigger, SegmentInfos)
Determine what set of merge operations are now necessary on the index.
Index
Declaration
public abstract MergePolicy.MergeSpecification FindMerges(MergeTrigger mergeTrigger, SegmentInfos segmentInfos)
Parameters
Type | Name | Description |
---|---|---|
Merge |
mergeTrigger | the event that triggered the merge |
Segment |
segmentInfos | the total set of segments in the index |
Returns
Type | Description |
---|---|
Merge |
IsMerged(SegmentInfos, SegmentCommitInfo)
Returns true
if this single info is already fully merged (has no
pending deletes, is in the same dir as the
writer, and matches the current compound file setting
Declaration
protected bool IsMerged(SegmentInfos infos, SegmentCommitInfo info)
Parameters
Type | Name | Description |
---|---|---|
Segment |
infos | |
Segment |
info |
Returns
Type | Description |
---|---|
System. |
SetIndexWriter(IndexWriter)
Sets the Index
Declaration
public virtual void SetIndexWriter(IndexWriter writer)
Parameters
Type | Name | Description |
---|---|---|
Index |
writer |
See Also
Size(SegmentCommitInfo)
Return the byte size of the provided
Segment
Declaration
protected virtual long Size(SegmentCommitInfo info)
Parameters
Type | Name | Description |
---|---|---|
Segment |
info |
Returns
Type | Description |
---|---|
System. |
UseCompoundFile(SegmentInfos, SegmentCommitInfo)
Returns true
if a new segment (regardless of its origin) should use the
compound file format. The default implementation returns true
iff the size of the given mergedInfo is less or equal to
Max
false
.
Declaration
public virtual bool UseCompoundFile(SegmentInfos infos, SegmentCommitInfo mergedInfo)
Parameters
Type | Name | Description |
---|---|---|
Segment |
infos | |
Segment |
mergedInfo |
Returns
Type | Description |
---|---|
System. |