StoredFieldsWriter

Codec API for writing stored fields:

  1. For every document, .startDocument is called, informing the Codec that a new document has started.

  2. writeField is called for each field in the document.

  3. After all documents have been written, .finish is called for verification/sanity-checks.

  4. Finally the writer is closed (.close)

Inheritors

Properties

Link copied to clipboard

Returns nested resources of this class. The result should be a point-in-time snapshot (to avoid race conditions).

Functions

Link copied to clipboard
abstract override fun close()
Link copied to clipboard
abstract fun finish(numDocs: Int)

Called before .close, passing in the number of documents that were written. Note that this is intentionally redundant (equivalent to the number of calls to .startDocument, but a Codec should check that this is the case to detect the JRE bug described in LUCENE-1282.

Link copied to clipboard
open fun finishDocument()

Called when a document and all its fields have been added.

Link copied to clipboard
open fun merge(mergeState: MergeState): Int

Merges in the stored fields from the readers in mergeState. The default implementation skips over deleted documents, and uses .startDocument, writeField, and .finish, returning the number of documents that were written. Implementations can override this method for more sophisticated merging (bulk-byte copying, etc).

Link copied to clipboard
abstract fun ramBytesUsed(): Long

Return the memory usage of this object in bytes. Negative values are illegal.

Link copied to clipboard
abstract fun startDocument()

Called before writing the stored fields of the document. writeField will be called for each stored field. Note that this is called even if the document has no stored fields.

Link copied to clipboard
abstract fun writeField(info: FieldInfo?, value: Double)

Writes a stored double value.

abstract fun writeField(info: FieldInfo?, value: Float)

Writes a stored float value.

abstract fun writeField(info: FieldInfo?, value: Int)

Writes a stored int value.

abstract fun writeField(info: FieldInfo?, value: Long)

Writes a stored long value.

abstract fun writeField(info: FieldInfo?, value: String)

Writes a stored String value.

open fun writeField(info: FieldInfo?, value: StoredFieldDataInput)

Writes a stored binary value from a StoredFieldDataInput.

abstract fun writeField(info: FieldInfo?, value: BytesRef)

Writes a stored binary value.