document

fun document(docID: Int): Document

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

NOTE: for performance reasons, this method does not check if the requested document is deleted, and therefore asking for a deleted document may yield unspecified results. Usually this is not required, however you can test if the doc is deleted by checking the Bits returned from MultiBits.getLiveDocs.

NOTE: only the content of a field is returned, if that field was stored during indexing. Metadata like boost, omitNorm, IndexOptions, tokenized, etc., are not preserved.

Throws

if the index is corrupt

IOException

if there is a low-level IO error


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.


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.