public class MockRandomMergePolicy extends MergePolicy
MergePolicy.MergeAbortedException, MergePolicy.MergeException, MergePolicy.MergeSpecification, MergePolicy.OneMerge
writer
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.
|
setIndexWriter
public MockRandomMergePolicy(Random random)
public MergePolicy.MergeSpecification findMerges(SegmentInfos segmentInfos)
MergePolicy
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.findMerges
in class MergePolicy
segmentInfos
- the total set of segments in the indexpublic MergePolicy.MergeSpecification findForcedMerges(SegmentInfos segmentInfos, int maxSegmentCount, Map<SegmentInfo,Boolean> segmentsToMerge) throws CorruptIndexException, IOException
MergePolicy
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.findForcedMerges
in class MergePolicy
segmentInfos
- 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.CorruptIndexException
IOException
public MergePolicy.MergeSpecification findForcedDeletesMerges(SegmentInfos segmentInfos) throws CorruptIndexException, IOException
MergePolicy
findForcedDeletesMerges
in class MergePolicy
segmentInfos
- the total set of segments in the indexCorruptIndexException
IOException
public void close()
MergePolicy
close
in interface Closeable
close
in class MergePolicy
public boolean useCompoundFile(SegmentInfos infos, SegmentInfo mergedInfo) throws IOException
MergePolicy
useCompoundFile
in class MergePolicy
IOException