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 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.voidbinaryField(FieldInfo fieldInfo, DataInput value, int length) Expert: Process a binary field directly from theDataInput.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, 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 theDataInput. Implementors of this method must readlengthbytes from the givenDataInput. The default implementation reads all byes in a newly created byte array and callsbinaryField(FieldInfo, byte[]).- Parameters:
value- newly allocated byte array with the binary contents.- 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.Statusrepresenting whether they need that particular field or not, or to stop processing entirely.- Throws:
IOException
-