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.DocMap, org.apache.lucene.index.MergePolicy.MergeAbortedException, org.apache.lucene.index.MergePolicy.MergeException, org.apache.lucene.index.MergePolicy.MergeSpecification, org.apache.lucene.index.MergePolicy.OneMerge| 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,
Map<org.apache.lucene.index.SegmentCommitInfo,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. |
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 IOException
findMerges in class org.apache.lucene.index.MergePolicyIOExceptionpublic org.apache.lucene.index.MergePolicy.MergeSpecification findForcedMerges(org.apache.lucene.index.SegmentInfos segmentInfos,
int maxSegmentCount,
Map<org.apache.lucene.index.SegmentCommitInfo,Boolean> segmentsToMerge,
org.apache.lucene.index.IndexWriter writer)
throws IOException
findForcedMerges in class org.apache.lucene.index.MergePolicyIOExceptionpublic org.apache.lucene.index.MergePolicy.MergeSpecification findForcedDeletesMerges(org.apache.lucene.index.SegmentInfos segmentInfos,
org.apache.lucene.index.IndexWriter writer)
throws IOException
findForcedDeletesMerges in class org.apache.lucene.index.MergePolicyIOExceptionpublic boolean useCompoundFile(org.apache.lucene.index.SegmentInfos segments,
org.apache.lucene.index.SegmentCommitInfo newSegment,
org.apache.lucene.index.IndexWriter writer)
throws IOException
useCompoundFile in class org.apache.lucene.index.MergePolicyIOExceptionpublic 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.Copyright © 2009–2016. All rights reserved.