tryDeleteDocument

fun tryDeleteDocument(readerIn: IndexReader, docID: Int): Long

Expert: attempts to delete by document ID, as long as the provided reader is a near-real-time reader (from DirectoryReader.open). If the provided reader is an NRT reader obtained from this writer, and its segment has not been merged away, then the delete succeeds and this method returns a valid (> 0) sequence number; else, it returns -1 and 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 .deleteDocuments).