public class MockRandomMergePolicy extends MergePolicy
MergePolicy.MergeAbortedException, MergePolicy.MergeException, MergePolicy.MergeSpecification, MergePolicy.OneMergewriter| Constructor and Description |
|---|
MockRandomMergePolicy(Random random) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Release all resources for the policy.
|
MergePolicy.MergeSpecification |
findForcedDeletesMerges(SegmentInfos segmentInfos)
Determine what set of merge operations is necessary in order to expunge all
deletes from the index.
|
MergePolicy.MergeSpecification |
findForcedMerges(SegmentInfos segmentInfos,
int maxSegmentCount,
Map<SegmentInfo,Boolean> segmentsToMerge)
Determine what set of merge operations is necessary in
order to merge to <= the specified segment count.
|
MergePolicy.MergeSpecification |
findMerges(SegmentInfos segmentInfos)
Determine what set of merge operations are now necessary on the index.
|
boolean |
useCompoundFile(SegmentInfos infos,
SegmentInfo mergedInfo)
Returns true if a new segment (regardless of its origin) should use the compound file format.
|
setIndexWriterpublic MockRandomMergePolicy(Random random)
public MergePolicy.MergeSpecification findMerges(SegmentInfos segmentInfos)
MergePolicyIndexWriter 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.findMerges in class MergePolicysegmentInfos - the total set of segments in the indexpublic MergePolicy.MergeSpecification findForcedMerges(SegmentInfos segmentInfos, int maxSegmentCount, Map<SegmentInfo,Boolean> segmentsToMerge) throws CorruptIndexException, IOException
MergePolicyIndexWriter 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.findForcedMerges in class MergePolicysegmentInfos - the total set of segments in the indexmaxSegmentCount - 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.CorruptIndexExceptionIOExceptionpublic MergePolicy.MergeSpecification findForcedDeletesMerges(SegmentInfos segmentInfos) throws CorruptIndexException, IOException
MergePolicyfindForcedDeletesMerges in class MergePolicysegmentInfos - the total set of segments in the indexCorruptIndexExceptionIOExceptionpublic void close()
MergePolicyclose in interface Closeableclose in class MergePolicypublic boolean useCompoundFile(SegmentInfos infos, SegmentInfo mergedInfo) throws IOException
MergePolicyuseCompoundFile in class MergePolicyIOException