C# 클래스 Lucene.Net.Index.MergePolicy

Expert: a MergePolicy determines the sequence of primitive merge operations to be used for overall merge and optimize operations.

Whenever the segments in an index have been altered by {@link 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, {@link IndexWriter} invokes {@link #findMerges} to give the MergePolicy a chance to pick merges that are now required. This method returns a {@link MergeSpecification} instance describing the set of merges that should be done, or null if no merges are necessary. When IndexWriter.optimize is called, it calls {@link #findMergesForOptimize} 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 {@link SerialMergeScheduler}, the merges will be run sequentially but if it is using {@link ConcurrentMergeScheduler} they will be run concurrently.

The default MergePolicy is {@link LogByteSizeMergePolicy}.

NOTE: This API is new and still experimental (subject to change suddenly in the next release)

파일 보기 프로젝트 열기: apache/lucenenet 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
DEFAULT_MAX_CFS_SEGMENT_SIZE long
MaxCFSSegmentSize long
NoCFSRatio_Renamed double
Writer SetOnce

공개 메소드들

메소드 설명
Clone ( ) : object
Dispose ( ) : void

Release all resources for the policy.

FindForcedDeletesMerges ( SegmentInfos segmentInfos ) : MergeSpecification

Determine what set of merge operations is necessary in order to expunge all deletes from the index.

FindForcedMerges ( SegmentInfos segmentInfos, int maxSegmentCount, bool?>.IDictionary segmentsToMerge ) : MergeSpecification

Determine what set of merge operations is necessary in order to merge to <= the specified segment count. IndexWriter calls this when its IndexWriter#forceMerge 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 mergeTrigger, SegmentInfos segmentInfos ) : MergeSpecification

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.

MergePolicy ( ) : System

Creates a new merge policy instance. Note that if you intend to use it without passing it to IndexWriter, you should call #setIndexWriter(IndexWriter).

UseCompoundFile ( SegmentInfos infos, Lucene.Net.Index.SegmentCommitInfo mergedInfo ) : bool

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 #getMaxCFSSegmentSizeMB() and the size is less or equal to the TotalIndexSize * #getNoCFSRatio() otherwise false.

보호된 메소드들

메소드 설명
IsMerged ( SegmentInfos infos, Lucene.Net.Index.SegmentCommitInfo info ) : bool

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

MergePolicy ( double defaultNoCFSRatio, long defaultMaxCFSSegmentSize ) : System

Creates a new merge policy instance with default settings for noCFSRatio and maxCFSSegmentSize. this ctor should be used by subclasses using different defaults than the MergePolicy

Size ( Lucene.Net.Index.SegmentCommitInfo info ) : long

Return the byte size of the provided {@link SegmentCommitInfo}, pro-rated by percentage of non-deleted documents is set.

메소드 상세

Clone() 공개 메소드

public Clone ( ) : object
리턴 object

Dispose() 공개 추상적인 메소드

Release all resources for the policy.
public abstract Dispose ( ) : void
리턴 void

FindForcedDeletesMerges() 공개 추상적인 메소드

Determine what set of merge operations is necessary in order to expunge all deletes from the index.
public abstract FindForcedDeletesMerges ( SegmentInfos segmentInfos ) : MergeSpecification
segmentInfos SegmentInfos /// the total set of segments in the index
리턴 MergeSpecification

FindForcedMerges() 공개 추상적인 메소드

Determine what set of merge operations is necessary in order to merge to <= the specified segment count. IndexWriter calls this when its IndexWriter#forceMerge method is called. this call is always synchronized on the IndexWriter instance so only one thread at a time will call this method.
public abstract FindForcedMerges ( SegmentInfos segmentInfos, int maxSegmentCount, bool?>.IDictionary segmentsToMerge ) : MergeSpecification
segmentInfos SegmentInfos /// the total set of segments in the index
maxSegmentCount int /// requested maximum number of segments in the index (currently this /// is always 1)
segmentsToMerge bool?>.IDictionary /// contains the specific SegmentInfo instances that must be merged /// away. this may be a subset of all /// SegmentInfos. If the value is True for a /// given SegmentInfo, that means this segment was /// an original segment present in the /// to-be-merged index; else, it was a segment /// produced by a cascaded merge.
리턴 MergeSpecification

FindMerges() 공개 추상적인 메소드

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.
public abstract FindMerges ( MergeTrigger mergeTrigger, SegmentInfos segmentInfos ) : MergeSpecification
mergeTrigger MergeTrigger the event that triggered the merge
segmentInfos SegmentInfos /// the total set of segments in the index
리턴 MergeSpecification

IsMerged() 보호된 메소드

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
protected IsMerged ( SegmentInfos infos, Lucene.Net.Index.SegmentCommitInfo info ) : bool
infos SegmentInfos
info Lucene.Net.Index.SegmentCommitInfo
리턴 bool

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).
public MergePolicy ( ) : System
리턴 System

MergePolicy() 보호된 메소드

Creates a new merge policy instance with default settings for noCFSRatio and maxCFSSegmentSize. this ctor should be used by subclasses using different defaults than the MergePolicy
protected MergePolicy ( double defaultNoCFSRatio, long defaultMaxCFSSegmentSize ) : System
defaultNoCFSRatio double
defaultMaxCFSSegmentSize long
리턴 System

Size() 보호된 메소드

Return the byte size of the provided {@link SegmentCommitInfo}, pro-rated by percentage of non-deleted documents is set.
protected Size ( Lucene.Net.Index.SegmentCommitInfo info ) : long
info Lucene.Net.Index.SegmentCommitInfo
리턴 long

UseCompoundFile() 공개 메소드

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 #getMaxCFSSegmentSizeMB() and the size is less or equal to the TotalIndexSize * #getNoCFSRatio() otherwise false.
public UseCompoundFile ( SegmentInfos infos, Lucene.Net.Index.SegmentCommitInfo mergedInfo ) : bool
infos SegmentInfos
mergedInfo Lucene.Net.Index.SegmentCommitInfo
리턴 bool

프로퍼티 상세

DEFAULT_MAX_CFS_SEGMENT_SIZE 보호되어 있는 정적으로 프로퍼티

Default max segment size in order to use compound file system. Set to Long#MAX_VALUE.
protected static long DEFAULT_MAX_CFS_SEGMENT_SIZE
리턴 long

MaxCFSSegmentSize 보호되어 있는 프로퍼티

If the size of the merged segment exceeds this value then it will not use compound file format.
protected long MaxCFSSegmentSize
리턴 long

NoCFSRatio_Renamed 보호되어 있는 프로퍼티

If the size of the merge segment exceeds this ratio of the total index size then it will remain in non-compound format
protected double NoCFSRatio_Renamed
리턴 double

Writer 보호되어 있는 프로퍼티

IndexWriter that contains this instance.
protected SetOnce Writer
리턴 SetOnce