Class NoMergePolicy
A MergePolicy which never returns merges to execute (hence it's name). It is also a singleton and can be accessed through NO_COMPOUND_FILES if you want to indicate the index does not use compound files, or through COMPOUND_FILES otherwise. Use it if you want to prevent an IndexWriter from ever executing merges, without going through the hassle of tweaking a merge policy's settings to achieve that, such as changing its merge factor.
Implements
Inherited Members
Namespace: Lucene.Net.Index
Assembly: Lucene.Net.dll
Syntax
public sealed class NoMergePolicy : MergePolicy, IDisposable
Fields
COMPOUND_FILES
A singleton NoMergePolicy which indicates the index uses compound files.
Declaration
public static readonly MergePolicy COMPOUND_FILES
Field Value
Type | Description |
---|---|
MergePolicy |
NO_COMPOUND_FILES
A singleton NoMergePolicy which indicates the index does not use compound files.
Declaration
public static readonly MergePolicy NO_COMPOUND_FILES
Field Value
Type | Description |
---|---|
MergePolicy |
Methods
Dispose(bool)
Release all resources for the policy.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing |
Overrides
FindForcedDeletesMerges(SegmentInfos)
Determine what set of merge operations is necessary in order to expunge all deletes from the index.
Declaration
public override MergePolicy.MergeSpecification FindForcedDeletesMerges(SegmentInfos segmentInfos)
Parameters
Type | Name | Description |
---|---|---|
SegmentInfos | segmentInfos | the total set of segments in the index |
Returns
Type | Description |
---|---|
MergePolicy.MergeSpecification |
Overrides
FindForcedMerges(SegmentInfos, int, IDictionary<SegmentCommitInfo, bool>)
Determine what set of merge operations is necessary in order to merge to <= the specified segment count. IndexWriter calls this when its ForceMerge(int, bool) method is called. This call is always synchronized on the IndexWriter instance so only one thread at a time will call this method.
Declaration
public override MergePolicy.MergeSpecification FindForcedMerges(SegmentInfos segmentInfos, int maxSegmentCount, IDictionary<SegmentCommitInfo, bool> segmentsToMerge)
Parameters
Type | Name | Description |
---|---|---|
SegmentInfos | segmentInfos | The total set of segments in the index |
int | maxSegmentCount | Requested maximum number of segments in the index (currently this is always 1) |
IDictionary<SegmentCommitInfo, bool> | segmentsToMerge | Contains the specific SegmentInfo instances that must be merged
away. This may be a subset of all
SegmentInfos. If the value is |
Returns
Type | Description |
---|---|
MergePolicy.MergeSpecification |
Overrides
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.
Declaration
public override MergePolicy.MergeSpecification FindMerges(MergeTrigger mergeTrigger, SegmentInfos segmentInfos)
Parameters
Type | Name | Description |
---|---|---|
MergeTrigger | mergeTrigger | the event that triggered the merge |
SegmentInfos | segmentInfos | the total set of segments in the index |
Returns
Type | Description |
---|---|
MergePolicy.MergeSpecification |
Overrides
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.
Declaration
public override void SetIndexWriter(IndexWriter writer)
Parameters
Type | Name | Description |
---|---|---|
IndexWriter | writer |
Overrides
See Also
Size(SegmentCommitInfo)
Return the byte size of the provided SegmentCommitInfo, pro-rated by percentage of non-deleted documents is set.
Declaration
protected override long Size(SegmentCommitInfo info)
Parameters
Type | Name | Description |
---|---|---|
SegmentCommitInfo | info |
Returns
Type | Description |
---|---|
long |
Overrides
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents the current object. |
Overrides
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
MaxCFSSegmentSizeMB and the size is less or equal to the
TotalIndexSize * NoCFSRatio otherwise
false
.
Declaration
public override bool UseCompoundFile(SegmentInfos segments, SegmentCommitInfo newSegment)
Parameters
Type | Name | Description |
---|---|---|
SegmentInfos | segments | |
SegmentCommitInfo | newSegment |
Returns
Type | Description |
---|---|
bool |