| java.lang.Object org.apache.lucene.index.MergePolicy org.apache.lucene.index.LogMergePolicy
All known Subclasses: org.apache.lucene.index.LogDocMergePolicy, org.apache.lucene.index.LogByteSizeMergePolicy,
LogMergePolicy | abstract public class LogMergePolicy extends MergePolicy (Code) | | This class implements a
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
LogMergePolicy.size method which specifies how a
segment's size is determined.
LogDocMergePolicy is one subclass that measures size by document count in
the segment.
LogByteSizeMergePolicy is another
subclass that measures size as the total byte size of the
file(s) for the segment.
|
Method Summary | |
public void | close() | public MergeSpecification | findMerges(SegmentInfos infos, IndexWriter writer) Checks if any merges are now necessary and returns a
MergePolicy.MergeSpecification if so. | public MergeSpecification | findMergesForOptimize(SegmentInfos infos, IndexWriter writer, int maxNumSegments, Set segmentsToOptimize) 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. | public int | getMaxMergeDocs() Returns the largest segment (measured by document
count) that may be merged with other segments. | public int | getMergeFactor() | public boolean | getUseCompoundDocStore() Returns true if newly flushed and newly merge doc
store segment files (term vectors and stored fields)
are written in compound file format. | public boolean | getUseCompoundFile() Returns true if newly flushed and newly merge segments
are written in compound file format. | public void | setMaxMergeDocs(int maxMergeDocs) Determines the largest segment (measured by
document count) that may be merged with other segments.
Small values (e.g., less than 10,000) are best for
interactive indexing, as this limits the length of
pauses while indexing to a few seconds. | public void | setMergeFactor(int mergeFactor) Determines how often segment indices are merged by
addDocument(). | public void | setUseCompoundDocStore(boolean useCompoundDocStore) Sets whether compound file format should be used for
newly flushed and newly merged doc store
segment files (term vectors and stored fields). | public void | setUseCompoundFile(boolean useCompoundFile) Sets whether compound file format should be used for
newly flushed and newly merged segments. | abstract protected long | size(SegmentInfo info) | public boolean | useCompoundDocStore(SegmentInfos infos) | public boolean | useCompoundFile(SegmentInfos infos, SegmentInfo info) |
DEFAULT_MAX_MERGE_DOCS | final public static int DEFAULT_MAX_MERGE_DOCS(Code) | | Default maximum segment size. A segment of this size
or larger will never be merged. @see setMaxMergeDocs
|
DEFAULT_MERGE_FACTOR | final public static int DEFAULT_MERGE_FACTOR(Code) | | Default merge factor, which is how many segments are
merged at a time
|
LEVEL_LOG_SPAN | final public static double LEVEL_LOG_SPAN(Code) | | Defines the allowed range of log(size) for each
level. A level is computed by taking the max segment
log size, minuse LEVEL_LOG_SPAN, and finding all
segments falling within that range.
|
maxMergeDocs | int maxMergeDocs(Code) | | |
maxMergeSize | long maxMergeSize(Code) | | |
minMergeSize | long minMergeSize(Code) | | |
close | public void close()(Code) | | |
findMergesForOptimize | public MergeSpecification findMergesForOptimize(SegmentInfos infos, IndexWriter writer, int maxNumSegments, Set segmentsToOptimize) throws IOException(Code) | | 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.
|
getMaxMergeDocs | public int getMaxMergeDocs()(Code) | | Returns the largest segment (measured by document
count) that may be merged with other segments.
See Also: LogMergePolicy.setMaxMergeDocs See Also: |
getMergeFactor | public int getMergeFactor()(Code) | | Returns the number of segments that are merged at
once and also controls the total number of segments
allowed to accumulate in the index.
|
getUseCompoundDocStore | public boolean getUseCompoundDocStore()(Code) | | Returns true if newly flushed and newly merge doc
store segment files (term vectors and stored fields)
are written in compound file format. @see
#setUseCompoundDocStore
|
getUseCompoundFile | public boolean getUseCompoundFile()(Code) | | Returns true if newly flushed and newly merge segments
are written in compound file format. @see
#setUseCompoundFile
|
setMaxMergeDocs | public void setMaxMergeDocs(int maxMergeDocs)(Code) | | Determines the largest segment (measured by
document count) that may be merged with other segments.
Small values (e.g., less than 10,000) are best for
interactive indexing, as this limits the length of
pauses while indexing to a few seconds. Larger values
are best for batched indexing and speedier
searches.
The default value is
Integer.MAX_VALUE .
The default merge policy (
LogByteSizeMergePolicy ) also allows you to set this
limit by net size (in MB) of the segment, using
LogByteSizeMergePolicy.setMaxMergeMB .
|
setMergeFactor | public void setMergeFactor(int mergeFactor)(Code) | | Determines how often segment indices are merged by
addDocument(). With smaller values, less RAM is used
while indexing, and searches on unoptimized indices are
faster, but indexing speed is slower. With larger
values, more RAM is used during indexing, and while
searches on unoptimized indices are slower, indexing is
faster. Thus larger values (> 10) are best for batch
index creation, and smaller values (< 10) for indices
that are interactively maintained.
|
setUseCompoundDocStore | public void setUseCompoundDocStore(boolean useCompoundDocStore)(Code) | | Sets whether compound file format should be used for
newly flushed and newly merged doc store
segment files (term vectors and stored fields).
|
setUseCompoundFile | public void setUseCompoundFile(boolean useCompoundFile)(Code) | | Sets whether compound file format should be used for
newly flushed and newly merged segments.
|
|
|