Package org.apache.lucene.index
Class StoredFields
java.lang.Object
org.apache.lucene.index.StoredFields
- Direct Known Subclasses:
StoredFieldsReader
API for reading stored fields.
NOTE: This class is not thread-safe and should only be consumed in the thread where it was acquired.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal Document
document
(int docID) Returns the stored fields of then
thDocument
in this index.final Document
Likedocument(int)
but only loads the specified fields.abstract void
document
(int docID, StoredFieldVisitor visitor) Expert: visits the fields of a stored document, for custom processing/loading of each field.
-
Constructor Details
-
StoredFields
protected StoredFields()Sole constructor. (For invocation by subclass constructors, typically implicit.)
-
-
Method Details
-
document
Returns the stored fields of then
thDocument
in this index. This is just sugar for usingDocumentStoredFieldVisitor
.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 fromMultiBits.getLiveDocs(org.apache.lucene.index.IndexReader)
.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:
CorruptIndexException
- if the index is corruptIOException
- if there is a low-level IO error
-
document
Expert: visits the fields of a stored document, for custom processing/loading of each field. If you simply want to load all fields, usedocument(int)
. If you want to load a subset, useDocumentStoredFieldVisitor
.- Throws:
IOException
-
document
Likedocument(int)
but only loads the specified fields. Note that this is simply sugar forDocumentStoredFieldVisitor(Set)
.- Throws:
IOException
-