Class TieredMergePolicy

Merges segments of approximately equal size, subject to
an allowed number of segments per tier. This is similar
to LogByteSizeMergePolicy, except this merge
policy is able to merge non-adjacent segment, and
separates how many segments are merged at once (setMaxMergeAtOnce(int)) from how many segments are allowed
per tier (setSegmentsPerTier(double)). This merge
policy also does not over-merge (i.e. cascade merges).

For normal merging, this policy first computes a
"budget" of how many segments are allowed to be in the
index. If the index is over-budget, then the policy
sorts segments by decreasing size (pro-rating by percent
deletes), and then finds the least-cost merge. Merge
cost is measured by a combination of the "skew" of the
merge (size of largest segment divided by smallest segment),
total merge size and percent deletes reclaimed,
so that merges with lower skew, smaller size
and those reclaiming more deletes, are
favored.

If a merge will produce a segment that's larger than
setMaxMergedSegmentMB(double), then the policy will
merge fewer segments (down to 1 at once, if that one has
deletions) to keep the segment size under budget.

NOTE: this policy freely merges non-adjacent
segments; if this is a problem, use LogMergePolicy.

NOTE: This policy always merges by byte size
of the segments, always pro-rates by percent deletes,
and does not apply any maximum segment size during
forceMerge (unlike LogByteSizeMergePolicy).

WARNING: This API is experimental and might change in incompatible ways in the next release.

setMaxMergedSegmentMB

Maximum sized segment to produce during
normal merging. This setting is approximate: the
estimate of the merged segment size is made by summing
sizes of to-be-merged segments (compensating for
percent deleted docs). Default is 5 GB.

getReclaimDeletesWeight

setFloorSegmentMB

Segments smaller than this are "rounded up" to this
size, ie treated as equal (floor) size for merge
selection. This is to prevent frequent flushing of
tiny segments from allowing a long tail in the index.
Default is 2 MB.

getUseCompoundFile

setNoCFSRatio

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. Default is 0.1.

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.

Determine what set of merge operations is necessary in
order to merge to <= the specified segment count. IndexWriter calls this when its
IndexWriter.forceMerge(int) method is called. This call is always
synchronized on the IndexWriter instance so only one thread at a
time will call this method.

maxSegmentCount - requested maximum number of segments in the index (currently this
is always 1)

segmentsToMerge - 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.

getMaxCFSSegmentSizeMB

setMaxCFSSegmentSizeMB

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 Double.POSITIVE_INFINITY (default) and noCFSRatio to 1.0
to always use CFS regardless of merge size.