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 longdvGenerationprivate java.lang.Stringfieldprivate PendingDeleteshardDeletes-
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 intapplySoftDeletes(DocIdSetIterator iterator, FixedBitSet bits)Clears all bits in the given bitset that are set and are also in the given DocIdSetIterator.private booleanassertPendingDeletes()(package private) static intcountSoftDeletes(DocIdSetIterator softDeletedDocs, Bits hardDeletes)(package private) booleandelete(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) voiddropChanges()Resets the pending docsprivate voidensureInitialized(IOSupplier<CodecReader> readerIOSupplier)(package private) BitsgetHardLiveDocs()Returns a snapshot of the hard live docs.(package private) booleanisFullyDeleted(IOSupplier<CodecReader> readerIOSupplier)Returnstrueiff the segment represented by thisPendingDeletesis fully deleted(package private) booleanmustInitOnDelete()Returnstrueif we have to initialize this PendingDeletes beforePendingDeletes.delete(int); otherwise this PendingDeletes is ready to accept deletes.(package private) intnumDeletesToMerge(MergePolicy policy, IOSupplier<CodecReader> readerIOSupplier)protected intnumPendingDeletes()Returns the number of pending deletes that are not written to disk.(package private) voidonDocValuesUpdate(FieldInfo info, DocValuesFieldUpdates.Iterator iterator)Called for every field update for the given field at flush time(package private) voidonNewReader(CodecReader reader, SegmentCommitInfo info)Called once a new reader is opened for this segment ie.private FieldInfosreadFieldInfos()java.lang.StringtoString()(package private) booleanwriteLiveDocs(Directory dir)Writes the live docs to disk and returnstrueif 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.IOExceptionDescription copied from class:PendingDeletesMarks a document as deleted in this segment and return true if a document got actually deleted or if the document was already deleted.- Overrides:
deletein classPendingDeletes- Throws:
java.io.IOException
-
numPendingDeletes
protected int numPendingDeletes()
Description copied from class:PendingDeletesReturns the number of pending deletes that are not written to disk.- Overrides:
numPendingDeletesin classPendingDeletes
-
onNewReader
void onNewReader(CodecReader reader, SegmentCommitInfo info) throws java.io.IOException
Description copied from class:PendingDeletesCalled once a new reader is opened for this segment ie. when deletes or updates are applied.- Overrides:
onNewReaderin classPendingDeletes- Throws:
java.io.IOException
-
writeLiveDocs
boolean writeLiveDocs(Directory dir) throws java.io.IOException
Description copied from class:PendingDeletesWrites the live docs to disk and returnstrueif any new docs were written.- Overrides:
writeLiveDocsin classPendingDeletes- Throws:
java.io.IOException
-
dropChanges
void dropChanges()
Description copied from class:PendingDeletesResets the pending docs- Overrides:
dropChangesin 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:PendingDeletesCalled for every field update for the given field at flush time- Overrides:
onDocValuesUpdatein 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:
toStringin classPendingDeletes
-
numDeletesToMerge
int numDeletesToMerge(MergePolicy policy, IOSupplier<CodecReader> readerIOSupplier) throws java.io.IOException
- Overrides:
numDeletesToMergein 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:PendingDeletesReturnstrueiff the segment represented by thisPendingDeletesis fully deleted- Overrides:
isFullyDeletedin classPendingDeletes- Throws:
java.io.IOException
-
readFieldInfos
private FieldInfos readFieldInfos() throws java.io.IOException
- Throws:
java.io.IOException
-
getHardLiveDocs
Bits getHardLiveDocs()
Description copied from class:PendingDeletesReturns a snapshot of the hard live docs.- Overrides:
getHardLiveDocsin classPendingDeletes
-
mustInitOnDelete
boolean mustInitOnDelete()
Description copied from class:PendingDeletesReturnstrueif 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:
mustInitOnDeletein classPendingDeletes
-
countSoftDeletes
static int countSoftDeletes(DocIdSetIterator softDeletedDocs, Bits hardDeletes) throws java.io.IOException
- Throws:
java.io.IOException
-
-