Package org.apache.lucene.index
Class PendingSoftDeletes
- java.lang.Object
-
- org.apache.lucene.index.PendingDeletes
-
- org.apache.lucene.index.PendingSoftDeletes
-
final class PendingSoftDeletes extends PendingDeletes
-
-
Field Summary
Fields Modifier and Type Field Description private long
dvGeneration
private java.lang.String
field
private PendingDeletes
hardDeletes
-
Fields inherited from class org.apache.lucene.index.PendingDeletes
info, liveDocsInitialized, pendingDeleteCount
-
-
Constructor Summary
Constructors Constructor Description PendingSoftDeletes(java.lang.String field, SegmentCommitInfo info)
PendingSoftDeletes(java.lang.String field, SegmentReader reader, SegmentCommitInfo info)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static int
applySoftDeletes(DocIdSetIterator iterator, FixedBitSet bits)
Clears all bits in the given bitset that are set and are also in the given DocIdSetIterator.private boolean
assertPendingDeletes()
(package private) static int
countSoftDeletes(DocIdSetIterator softDeletedDocs, Bits hardDeletes)
(package private) boolean
delete(int docID)
Marks a document as deleted in this segment and return true if a document got actually deleted or if the document was already deleted.(package private) void
dropChanges()
Resets the pending docsprivate void
ensureInitialized(IOSupplier<CodecReader> readerIOSupplier)
(package private) Bits
getHardLiveDocs()
Returns a snapshot of the hard live docs.(package private) boolean
isFullyDeleted(IOSupplier<CodecReader> readerIOSupplier)
Returnstrue
iff the segment represented by thisPendingDeletes
is fully deleted(package private) boolean
mustInitOnDelete()
Returnstrue
if we have to initialize this PendingDeletes beforePendingDeletes.delete(int)
; otherwise this PendingDeletes is ready to accept deletes.(package private) int
numDeletesToMerge(MergePolicy policy, IOSupplier<CodecReader> readerIOSupplier)
protected int
numPendingDeletes()
Returns the number of pending deletes that are not written to disk.(package private) void
onDocValuesUpdate(FieldInfo info, DocValuesFieldUpdates.Iterator iterator)
Called for every field update for the given field at flush time(package private) void
onNewReader(CodecReader reader, SegmentCommitInfo info)
Called once a new reader is opened for this segment ie.private FieldInfos
readFieldInfos()
java.lang.String
toString()
(package private) boolean
writeLiveDocs(Directory dir)
Writes the live docs to disk and returnstrue
if any new docs were written.-
Methods inherited from class org.apache.lucene.index.PendingDeletes
getDelCount, getLiveDocs, getMutableBits, needsRefresh, numDocs, verifyDocCounts
-
-
-
-
Field Detail
-
field
private final java.lang.String field
-
dvGeneration
private long dvGeneration
-
hardDeletes
private final PendingDeletes hardDeletes
-
-
Constructor Detail
-
PendingSoftDeletes
PendingSoftDeletes(java.lang.String field, SegmentCommitInfo info)
-
PendingSoftDeletes
PendingSoftDeletes(java.lang.String field, SegmentReader reader, SegmentCommitInfo info)
-
-
Method Detail
-
delete
boolean delete(int docID) throws java.io.IOException
Description copied from class:PendingDeletes
Marks a document as deleted in this segment and return true if a document got actually deleted or if the document was already deleted.- Overrides:
delete
in classPendingDeletes
- Throws:
java.io.IOException
-
numPendingDeletes
protected int numPendingDeletes()
Description copied from class:PendingDeletes
Returns the number of pending deletes that are not written to disk.- Overrides:
numPendingDeletes
in classPendingDeletes
-
onNewReader
void onNewReader(CodecReader reader, SegmentCommitInfo info) throws java.io.IOException
Description copied from class:PendingDeletes
Called once a new reader is opened for this segment ie. when deletes or updates are applied.- Overrides:
onNewReader
in classPendingDeletes
- Throws:
java.io.IOException
-
writeLiveDocs
boolean writeLiveDocs(Directory dir) throws java.io.IOException
Description copied from class:PendingDeletes
Writes the live docs to disk and returnstrue
if any new docs were written.- Overrides:
writeLiveDocs
in classPendingDeletes
- Throws:
java.io.IOException
-
dropChanges
void dropChanges()
Description copied from class:PendingDeletes
Resets the pending docs- Overrides:
dropChanges
in classPendingDeletes
-
applySoftDeletes
static int applySoftDeletes(DocIdSetIterator iterator, FixedBitSet bits) throws java.io.IOException
Clears all bits in the given bitset that are set and are also in the given DocIdSetIterator.- Parameters:
iterator
- the doc ID set iterator for applybits
- the bit set to apply the deletes to- Returns:
- the number of bits changed by this function
- Throws:
java.io.IOException
-
onDocValuesUpdate
void onDocValuesUpdate(FieldInfo info, DocValuesFieldUpdates.Iterator iterator) throws java.io.IOException
Description copied from class:PendingDeletes
Called for every field update for the given field at flush time- Overrides:
onDocValuesUpdate
in classPendingDeletes
- Parameters:
info
- the field info of the field that's updatediterator
- the values to apply- Throws:
java.io.IOException
-
assertPendingDeletes
private boolean assertPendingDeletes()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classPendingDeletes
-
numDeletesToMerge
int numDeletesToMerge(MergePolicy policy, IOSupplier<CodecReader> readerIOSupplier) throws java.io.IOException
- Overrides:
numDeletesToMerge
in classPendingDeletes
- Throws:
java.io.IOException
-
ensureInitialized
private void ensureInitialized(IOSupplier<CodecReader> readerIOSupplier) throws java.io.IOException
- Throws:
java.io.IOException
-
isFullyDeleted
boolean isFullyDeleted(IOSupplier<CodecReader> readerIOSupplier) throws java.io.IOException
Description copied from class:PendingDeletes
Returnstrue
iff the segment represented by thisPendingDeletes
is fully deleted- Overrides:
isFullyDeleted
in classPendingDeletes
- Throws:
java.io.IOException
-
readFieldInfos
private FieldInfos readFieldInfos() throws java.io.IOException
- Throws:
java.io.IOException
-
getHardLiveDocs
Bits getHardLiveDocs()
Description copied from class:PendingDeletes
Returns a snapshot of the hard live docs.- Overrides:
getHardLiveDocs
in classPendingDeletes
-
mustInitOnDelete
boolean mustInitOnDelete()
Description copied from class:PendingDeletes
Returnstrue
if we have to initialize this PendingDeletes beforePendingDeletes.delete(int)
; otherwise this PendingDeletes is ready to accept deletes. A PendingDeletes can be initialized by providing it a reader viaPendingDeletes.onNewReader(CodecReader, SegmentCommitInfo)
.- Overrides:
mustInitOnDelete
in classPendingDeletes
-
countSoftDeletes
static int countSoftDeletes(DocIdSetIterator softDeletedDocs, Bits hardDeletes) throws java.io.IOException
- Throws:
java.io.IOException
-
-