softUpdateDocument

fun softUpdateDocument(term: Term?, doc: Iterable<out IndexableField>, vararg softDeletes: Field): Long

Expert: Updates a document by first updating the document(s) containing term with the given doc-values fields and then adding the new document. The doc-values update and the subsequent addition are atomic, as seen by a reader on the same index (a flush may happen only after the addition).

One use of this API is to retain older versions of documents instead of replacing them. The existing documents can be updated to reflect they are no longer current, while atomically adding new documents at the same time.

In contrast to .updateDocument this method will not delete documents in the index matching the given term but instead update them with the given doc-values fields which can be used as a soft-delete mechanism.

See .addDocuments and .updateDocuments.

Return

The #sequence_number for this operation

Throws

if the index is corrupt

IOException

if there is a low-level IO error