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.
|Constructor and Description|
Creates a new
|Modifier and Type||Method and Description|
Returns true if the segment represented by the given CodecReader should be keep even if it's fully deleted.
Returns the number of deletes that a merge would claim on the given segment.
findForcedDeletesMerges, findForcedMerges, findFullFlushMerges, findMerges
getMaxCFSSegmentSizeMB, getNoCFSRatio, setMaxCFSSegmentSizeMB, setNoCFSRatio, size, toString, useCompoundFile
assertDelCount, isMerged, message, segString, verbose
public SoftDeletesRetentionMergePolicy(String field, Supplier<Query> retentionQuerySupplier, MergePolicy in)
field- the soft deletes field
retentionQuerySupplier- a query supplier for the retention query
in- the wrapped MergePolicy
public boolean keepFullyDeletedSegment(IOSupplier<CodecReader> readerIOSupplier) throws IOException
public int numDeletesToMerge(SegmentCommitInfo info, int delCount, IOSupplier<CodecReader> readerSupplier) throws IOException
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
IndexWriter.softUpdateDocument(Term, Iterable, Field...),
Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.