StoredFields

abstract class StoredFields

API for reading stored fields.

NOTE: This class is not thread-safe and should only be consumed in the thread where it was acquired.

Inheritors

Functions

Link copied to clipboard
fun document(docID: Int): Document

Returns the stored fields of the nth Document in this index. This is just sugar for using DocumentStoredFieldVisitor.

fun document(docID: Int, fieldsToLoad: MutableSet<String>): Document

Like .document but only loads the specified fields. Note that this is simply sugar for DocumentStoredFieldVisitor.DocumentStoredFieldVisitor.

abstract fun document(docID: Int, visitor: StoredFieldVisitor)

Expert: visits the fields of a stored document, for custom processing/loading of each field. If you simply want to load all fields, use .document. If you want to load a subset, use DocumentStoredFieldVisitor.

Link copied to clipboard
open fun prefetch(docID: Int)

Optional method: Give a hint to this StoredFields instance that the given document will be read in the near future. This typically delegates to IndexInput.prefetch and is useful to parallelize I/O across multiple documents.