C# Class Lucene.Net.Index.LogMergePolicy

This class implements a {@link MergePolicy} that tries to merge segments into levels of exponentially increasing size, where each level has < mergeFactor segments in it. Whenever a given levle has mergeFactor segments or more in it, they will be merged.

This class is abstract and requires a subclass to define the {@link #size} method which specifies how a segment's size is determined. {@link LogDocMergePolicy} is one subclass that measures size by document count in the segment. {@link LogByteSizeMergePolicy} is another subclass that measures size as the total byte size of the file(s) for the segment.

Inheritance: MergePolicy
Mostra file Open project: synhershko/lucene.net Class Usage Examples

Public Properties

Property Type Description
DEFAULT_MAX_MERGE_DOCS int
DEFAULT_NO_CFS_RATIO double

Protected Properties

Property Type Description
internalCalibrateSizeByDeletes bool
internalNoCFSRatio double

Public Methods

Method Description
FindMerges ( SegmentInfos infos ) : MergeSpecification

Checks if any merges are now necessary and returns a MergePolicy.MergeSpecification if so. A merge is necessary when there are more than SetMergeFactor segments at a given level. When multiple levels have too many segments, this method will return multiple merges, allowing the MergeScheduler to use concurrency.

FindMergesForOptimize ( SegmentInfos infos, int maxNumSegments, ISet segmentsToOptimize ) : MergeSpecification

Returns the merges necessary to optimize the index. This merge policy defines "optimized" to mean only one segment in the index, where that segment has no deletions pending nor separate norms, and it is in compound file format if the current useCompoundFile setting is true. This method returns multiple merges (mergeFactor at a time) so the MergeScheduler in use may make use of concurrency.

FindMergesToExpungeDeletes ( SegmentInfos segmentInfos ) : MergeSpecification

Finds merges necessary to expunge all deletes from the index. We simply merge adjacent segments that have deletes, up to mergeFactor at a time.

SetUseCompoundDocStore ( bool useCompoundDocStore ) : void

Sets whether compound file format should be used for newly flushed and newly merged doc store segment files (term vectors and stored fields).

SetUseCompoundFile ( bool useCompoundFile ) : void

Gets or sets whether compound file format should be used for newly flushed and newly merged segments.

UseCompoundDocStore ( SegmentInfos infos ) : bool
UseCompoundFile ( SegmentInfos infos, SegmentInfo info ) : bool

Protected Methods

Method Description
LogMergePolicy ( IndexWriter writer ) : System
MakeOneMerge ( SegmentInfos infos, SegmentInfos infosToMerge ) : OneMerge
Size ( SegmentInfo info ) : long
SizeBytes ( SegmentInfo info ) : long
SizeDocs ( SegmentInfo info ) : long
Verbose ( ) : bool

Private Methods

Method Description
GetUseCompoundDocStore ( ) : bool
GetUseCompoundFile ( ) : bool
IsOptimized ( SegmentInfo info ) : bool

Returns true if this single info is optimized (has no pending norms or deletes, is in the same dir as the writer, and matches the current compound file setting

IsOptimized ( SegmentInfos infos, int maxNumSegments, ISet segmentsToOptimize ) : bool
Message ( System message ) : void

Method Details

FindMerges() public method

Checks if any merges are now necessary and returns a MergePolicy.MergeSpecification if so. A merge is necessary when there are more than SetMergeFactor segments at a given level. When multiple levels have too many segments, this method will return multiple merges, allowing the MergeScheduler to use concurrency.
public FindMerges ( SegmentInfos infos ) : MergeSpecification
infos SegmentInfos
return MergeSpecification

FindMergesForOptimize() public method

Returns the merges necessary to optimize the index. This merge policy defines "optimized" to mean only one segment in the index, where that segment has no deletions pending nor separate norms, and it is in compound file format if the current useCompoundFile setting is true. This method returns multiple merges (mergeFactor at a time) so the MergeScheduler in use may make use of concurrency.
public FindMergesForOptimize ( SegmentInfos infos, int maxNumSegments, ISet segmentsToOptimize ) : MergeSpecification
infos SegmentInfos
maxNumSegments int
segmentsToOptimize ISet
return MergeSpecification

FindMergesToExpungeDeletes() public method

Finds merges necessary to expunge all deletes from the index. We simply merge adjacent segments that have deletes, up to mergeFactor at a time.
public FindMergesToExpungeDeletes ( SegmentInfos segmentInfos ) : MergeSpecification
segmentInfos SegmentInfos
return MergeSpecification

LogMergePolicy() protected method

protected LogMergePolicy ( IndexWriter writer ) : System
writer IndexWriter
return System

MakeOneMerge() protected method

protected MakeOneMerge ( SegmentInfos infos, SegmentInfos infosToMerge ) : OneMerge
infos SegmentInfos
infosToMerge SegmentInfos
return OneMerge

SetUseCompoundDocStore() public method

Sets whether compound file format should be used for newly flushed and newly merged doc store segment files (term vectors and stored fields).
public SetUseCompoundDocStore ( bool useCompoundDocStore ) : void
useCompoundDocStore bool
return void

SetUseCompoundFile() public method

Gets or sets whether compound file format should be used for newly flushed and newly merged segments.
public SetUseCompoundFile ( bool useCompoundFile ) : void
useCompoundFile bool
return void

Size() abstract protected method

abstract protected Size ( SegmentInfo info ) : long
info SegmentInfo
return long

SizeBytes() protected method

protected SizeBytes ( SegmentInfo info ) : long
info SegmentInfo
return long

SizeDocs() protected method

protected SizeDocs ( SegmentInfo info ) : long
info SegmentInfo
return long

UseCompoundDocStore() public method

public UseCompoundDocStore ( SegmentInfos infos ) : bool
infos SegmentInfos
return bool

UseCompoundFile() public method

public UseCompoundFile ( SegmentInfos infos, SegmentInfo info ) : bool
infos SegmentInfos
info SegmentInfo
return bool

Verbose() protected method

protected Verbose ( ) : bool
return bool

Property Details

DEFAULT_MAX_MERGE_DOCS public_oe static_oe property

Default maximum segment size. A segment of this size
public static int DEFAULT_MAX_MERGE_DOCS
return int

DEFAULT_NO_CFS_RATIO public_oe static_oe property

Default noCFSRatio. If a merge's size is >= 10% of the index, then we disable compound file for it. See SetNoCFSRatio
public static double DEFAULT_NO_CFS_RATIO
return double

internalCalibrateSizeByDeletes protected_oe property

protected bool internalCalibrateSizeByDeletes
return bool

internalNoCFSRatio protected_oe property

protected double internalNoCFSRatio
return double