Method TryDeleteDocument
TryDeleteDocument(IndexReader, Int32)
Expert: attempts to delete by document ID, as long as
the provided readerIn
is a near-real-time reader (from
Open(IndexWriter, Boolean). If the
provided readerIn
is an NRT reader obtained from this
writer, and its segment has not been merged away, then
the delete succeeds and this method returns true
; else, it
returns false
the caller must then separately delete by
Term or Query.
NOTE: this method can only delete documents visible to the currently open NRT reader. If you need to delete documents indexed after opening the NRT reader you must use the other DeleteDocument() methods (e.g., DeleteDocuments(Term)).
Declaration
public virtual bool TryDeleteDocument(IndexReader readerIn, int docID)
Parameters
Type | Name | Description |
---|---|---|
IndexReader | readerIn | |
System.Int32 | docID |
Returns
Type | Description |
---|---|
System.Boolean |