public final class SoftDeletesRetentionMergePolicy extends OneMergeWrappingMergePolicy
MergePolicyallows 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.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
Nested Class Summary
Method SummaryModifier and TypeMethodDescription
booleanReturns true if the segment represented by the given CodecReader should be keep even if it's fully deleted.
intReturns the number of deletes that a merge would claim on the given segment.
Methods inherited from class org.apache.lucene.index.OneMergeWrappingMergePolicy
findForcedDeletesMerges, findForcedMerges, findFullFlushMerges, findMerges
Methods inherited from class org.apache.lucene.index.FilterMergePolicy
getMaxCFSSegmentSizeMB, getNoCFSRatio, setMaxCFSSegmentSizeMB, setNoCFSRatio, size, toString, unwrap, useCompoundFile
Methods inherited from class org.apache.lucene.index.MergePolicy
assertDelCount, isMerged, message, segString, verbose
keepFullyDeletedSegmentDescription copied from class:
MergePolicyReturns true if the segment represented by the given CodecReader should be keep even if it's fully deleted. This is useful for testing of for instance if the merge policy implements retention policies for soft deletes.
numDeletesToMergepublic int numDeletesToMerge
(SegmentCommitInfo info, int delCount, IOSupplier<CodecReader> readerSupplier) throws IOExceptionDescription copied from class:
MergePolicyReturns the number of deletes that a merge would claim on the given segment. This method will by default return the sum of the del count on disk and the pending delete count. Yet, subclasses that wrap merge readers might modify this to reflect deletes that are carried over to the target segment in the case of soft deletes.
Soft deletes all deletes to survive across merges in order to control when the soft-deleted data is claimed.
info- the segment info that identifies the segment
delCount- the number deleted documents for this segment
readerSupplier- a supplier that allows to obtain a
CodecReaderfor this segment
- See Also: