public final class ElasticsearchMergePolicy
extends org.apache.lucene.index.MergePolicy
MergePolicy
that upgrades segments and can upgrade merges.
It can be useful to use the background merging process to upgrade segments, for example when we perform internal changes that imply different index options or when a user modifies his mapping in non-breaking ways: we could imagine using this merge policy to be able to add doc values to fields after the fact or on the opposite to remove them.
For now, this MergePolicy
takes care of moving versions that used to
be stored as payloads to numeric doc values.
org.apache.lucene.index.MergePolicy.MergeAbortedException, org.apache.lucene.index.MergePolicy.MergeException, org.apache.lucene.index.MergePolicy.MergeSpecification, org.apache.lucene.index.MergePolicy.OneMerge, org.apache.lucene.index.MergePolicy.OneMergeProgress
Constructor and Description |
---|
ElasticsearchMergePolicy(org.apache.lucene.index.MergePolicy delegate) |
Modifier and Type | Method and Description |
---|---|
org.apache.lucene.index.MergePolicy.MergeSpecification |
findForcedDeletesMerges(org.apache.lucene.index.SegmentInfos segmentInfos,
org.apache.lucene.index.IndexWriter writer) |
org.apache.lucene.index.MergePolicy.MergeSpecification |
findForcedMerges(org.apache.lucene.index.SegmentInfos segmentInfos,
int maxSegmentCount,
java.util.Map<org.apache.lucene.index.SegmentCommitInfo,java.lang.Boolean> segmentsToMerge,
org.apache.lucene.index.IndexWriter writer) |
org.apache.lucene.index.MergePolicy.MergeSpecification |
findMerges(org.apache.lucene.index.MergeTrigger mergeTrigger,
org.apache.lucene.index.SegmentInfos segmentInfos,
org.apache.lucene.index.IndexWriter writer) |
void |
setUpgradeInProgress(boolean upgrade,
boolean onlyAncientSegments)
When
upgrade is true, running a force merge will upgrade any segments written
with older versions. |
java.lang.String |
toString() |
boolean |
useCompoundFile(org.apache.lucene.index.SegmentInfos segments,
org.apache.lucene.index.SegmentCommitInfo newSegment,
org.apache.lucene.index.IndexWriter writer) |
public ElasticsearchMergePolicy(org.apache.lucene.index.MergePolicy delegate)
delegate
- the merge policy to wrappublic org.apache.lucene.index.MergePolicy.MergeSpecification findMerges(org.apache.lucene.index.MergeTrigger mergeTrigger, org.apache.lucene.index.SegmentInfos segmentInfos, org.apache.lucene.index.IndexWriter writer) throws java.io.IOException
findMerges
in class org.apache.lucene.index.MergePolicy
java.io.IOException
public org.apache.lucene.index.MergePolicy.MergeSpecification findForcedMerges(org.apache.lucene.index.SegmentInfos segmentInfos, int maxSegmentCount, java.util.Map<org.apache.lucene.index.SegmentCommitInfo,java.lang.Boolean> segmentsToMerge, org.apache.lucene.index.IndexWriter writer) throws java.io.IOException
findForcedMerges
in class org.apache.lucene.index.MergePolicy
java.io.IOException
public org.apache.lucene.index.MergePolicy.MergeSpecification findForcedDeletesMerges(org.apache.lucene.index.SegmentInfos segmentInfos, org.apache.lucene.index.IndexWriter writer) throws java.io.IOException
findForcedDeletesMerges
in class org.apache.lucene.index.MergePolicy
java.io.IOException
public boolean useCompoundFile(org.apache.lucene.index.SegmentInfos segments, org.apache.lucene.index.SegmentCommitInfo newSegment, org.apache.lucene.index.IndexWriter writer) throws java.io.IOException
useCompoundFile
in class org.apache.lucene.index.MergePolicy
java.io.IOException
public void setUpgradeInProgress(boolean upgrade, boolean onlyAncientSegments)
upgrade
is true, running a force merge will upgrade any segments written
with older versions. This will apply to the next call to
IndexWriter.forceMerge(int)
that is handled by this MergePolicy
, as well as
cascading calls made by IndexWriter
.public java.lang.String toString()
toString
in class java.lang.Object