public final class SoftDeletesRetentionMergePolicy extends OneMergeWrappingMergePolicy
MergePolicy allows to carry over soft deleted documents across merges. The policy wraps
the merge reader and marks documents as "live" that have a value in the soft delete field and match the
provided query. This allows for instance to keep documents alive based on time or any other constraint in the index.
The main purpose for this merge policy is to implement retention policies for document modification to vanish in the
index. Using this merge policy allows to control when soft deletes are claimed by merges.MergePolicy.MergeAbortedException, MergePolicy.MergeContext, MergePolicy.MergeException, MergePolicy.MergeSpecification, MergePolicy.OneMerge, MergePolicy.OneMergeProgressinDEFAULT_MAX_CFS_SEGMENT_SIZE, DEFAULT_NO_CFS_RATIO, maxCFSSegmentSize, noCFSRatio| Constructor and Description |
|---|
SoftDeletesRetentionMergePolicy(String field,
Supplier<Query> retentionQuerySupplier,
MergePolicy in)
Creates a new
SoftDeletesRetentionMergePolicy |
| Modifier and Type | Method and Description |
|---|---|
boolean |
keepFullyDeletedSegment(IOSupplier<CodecReader> readerIOSupplier)
Returns true if the segment represented by the given CodecReader should be keep even if it's fully deleted.
|
int |
numDeletesToMerge(SegmentCommitInfo info,
int delCount,
IOSupplier<CodecReader> readerSupplier)
Returns the number of deletes that a merge would claim on the given segment.
|
findForcedDeletesMerges, findForcedMerges, findFullFlushMerges, findMergesgetMaxCFSSegmentSizeMB, getNoCFSRatio, setMaxCFSSegmentSizeMB, setNoCFSRatio, size, toString, useCompoundFileassertDelCount, isMerged, message, segString, verbosepublic SoftDeletesRetentionMergePolicy(String field, Supplier<Query> retentionQuerySupplier, MergePolicy in)
SoftDeletesRetentionMergePolicyfield - the soft deletes fieldretentionQuerySupplier - a query supplier for the retention queryin - the wrapped MergePolicypublic boolean keepFullyDeletedSegment(IOSupplier<CodecReader> readerIOSupplier) throws IOException
MergePolicykeepFullyDeletedSegment in class FilterMergePolicyIOExceptionpublic int numDeletesToMerge(SegmentCommitInfo info, int delCount, IOSupplier<CodecReader> readerSupplier) throws IOException
MergePolicynumDeletesToMerge in class FilterMergePolicyinfo - the segment info that identifies the segmentdelCount - the number deleted documents for this segmentreaderSupplier - a supplier that allows to obtain a CodecReader for this segmentIOExceptionIndexWriter.softUpdateDocument(Term, Iterable, Field...),
IndexWriterConfig.setSoftDeletesField(String)Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.