Package org.apache.lucene.index
Class StoredFieldVisitor
java.lang.Object
org.apache.lucene.index.StoredFieldVisitor
- Direct Known Subclasses:
DocumentStoredFieldVisitor,SortingStoredFieldsConsumer.CopyVisitor,StoredFieldsWriter.MergeVisitor,UnifiedHighlighter.LimitedStoredFieldVisitor
Expert: provides a low-level means of accessing the stored field
values in an index. See
IndexReader.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 IndexReader.document(int).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumeration of possible return values forneedsField(org.apache.lucene.index.FieldInfo). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbinaryField(FieldInfo fieldInfo, byte[] value) Process a binary field.voiddoubleField(FieldInfo fieldInfo, double value) Process a double numeric field.voidfloatField(FieldInfo fieldInfo, float value) Process a float numeric field.voidProcess a int numeric field.voidProcess a long numeric field.abstract StoredFieldVisitor.StatusneedsField(FieldInfo fieldInfo) Hook before processing a field.voidstringField(FieldInfo fieldInfo, byte[] value) Process a string field; the provided byte[] value is a UTF-8 encoded string value.
-
Constructor Details
-
StoredFieldVisitor
protected StoredFieldVisitor()Sole constructor. (For invocation by subclass constructors, typically implicit.)
-
-
Method Details
-
binaryField
Process a binary field.- Parameters:
value- newly allocated byte array with the binary contents.- Throws:
IOException
-
stringField
Process a string field; the provided byte[] value is a UTF-8 encoded string value.- 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.Statusrepresenting whether they need that particular field or not, or to stop processing entirely.- Throws:
IOException
-