Class UpgradeIndexMergePolicy
This MergePolicy is used for upgrading all existing segments of an index when calling ForceMerge(Int32). All other methods delegate to the base MergePolicy given to the constructor. This allows for an as-cheap-as possible upgrade of an older index by only upgrading segments that are created by previous Lucene versions. ForceMerge does no longer really merge; it is just used to "ForceMerge" older segment versions away.
In general one would use IndexUpgrader, but for a fully customizeable upgrade, you can use this like any other MergePolicy and call ForceMerge(Int32):
IndexWriterConfig iwc = new IndexWriterConfig(LuceneVersion.LUCENE_XX, new KeywordAnalyzer());
iwc.MergePolicy = new UpgradeIndexMergePolicy(iwc.MergePolicy);
using (IndexWriter w = new IndexWriter(dir, iwc))
{
w.ForceMerge(1);
}
Warning: this merge policy may reorder documents if the index was partially
upgraded before calling ForceMerge(Int32) (e.g., documents were added). If your application relies
on "monotonicity" of doc IDs (which means that the order in which the documents
were added to the index is preserved), do a ForceMerge(1)
instead. Please note, the
delegate MergePolicy may also reorder documents.
@lucene.experimental
Inherited Members
Assembly: DistributedLucene.Net.dll
Syntax
public class UpgradeIndexMergePolicy : MergePolicy
Constructors
Name | Description |
---|---|
UpgradeIndexMergePolicy(MergePolicy) | Wrap the given MergePolicy and intercept ForceMerge(Int32) requests to only upgrade segments written with previous Lucene versions. |
Fields
Name | Description |
---|---|
m_base | Wrapped MergePolicy. |
Methods
Name | Description |
---|---|
Dispose(Boolean) | |
FindForcedDeletesMerges(SegmentInfos) | |
FindForcedMerges(SegmentInfos, Int32, IDictionary<SegmentCommitInfo, Nullable<Boolean>>) | |
FindMerges(MergeTrigger, SegmentInfos) | |
SetIndexWriter(IndexWriter) | |
ShouldUpgradeSegment(SegmentCommitInfo) | Returns |
ToString() | |
UseCompoundFile(SegmentInfos, SegmentCommitInfo) |