Package org.apache.lucene.index
Class StoredFieldVisitor
java.lang.Object
org.apache.lucene.index.StoredFieldVisitor
- Direct Known Subclasses:
DocumentStoredFieldVisitor
,StoredFieldsWriter.MergeVisitor
Expert: provides a low-level means of accessing the stored field values in an index. See
StoredFields.document(int, StoredFieldVisitor)
.
NOTE: a StoredFieldVisitor
implementation should not try to load or visit other
stored documents in the same reader because the implementation of stored fields for most codecs
is not reentrant and you will see strange exceptions as a result.
See DocumentStoredFieldVisitor
, which is a StoredFieldVisitor
that builds
the Document
containing all stored fields. This is used by StoredFields.document(int)
.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enumeration of possible return values forneedsField(org.apache.lucene.index.FieldInfo)
. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
binaryField
(FieldInfo fieldInfo, byte[] value) Process a binary field.void
binaryField
(FieldInfo fieldInfo, StoredFieldDataInput value) Expert: Process a binary field directly from theStoredFieldDataInput
.void
doubleField
(FieldInfo fieldInfo, double value) Process a double numeric field.void
floatField
(FieldInfo fieldInfo, float value) Process a float numeric field.void
Process a int numeric field.void
Process a long numeric field.abstract StoredFieldVisitor.Status
needsField
(FieldInfo fieldInfo) Hook before processing a field.void
stringField
(FieldInfo fieldInfo, String value) Process a string field.
-
Constructor Details
-
StoredFieldVisitor
protected StoredFieldVisitor()Sole constructor. (For invocation by subclass constructors, typically implicit.)
-
-
Method Details
-
binaryField
Expert: Process a binary field directly from theStoredFieldDataInput
. Implementors of this method must readStoredFieldDataInput#length
bytes from the givenStoredFieldDataInput
. The default implementation reads all bytes in a newly created byte array and callsbinaryField(FieldInfo, byte[])
.- Parameters:
value
- the stored field data input.- Throws:
IOException
-
binaryField
Process a binary field.- Parameters:
value
- newly allocated byte array with the binary contents.- Throws:
IOException
-
stringField
Process a string field.- Throws:
IOException
-
intField
Process a int numeric field.- Throws:
IOException
-
longField
Process a long numeric field.- Throws:
IOException
-
floatField
Process a float numeric field.- Throws:
IOException
-
doubleField
Process a double numeric field.- Throws:
IOException
-
needsField
Hook before processing a field. Before a field is processed, this method is invoked so that subclasses can return aStoredFieldVisitor.Status
representing whether they need that particular field or not, or to stop processing entirely.- Throws:
IOException
-