public class DocumentStoredFieldVisitor extends StoredFieldVisitor
StoredFieldVisitor
that creates a Document
from stored fields.
This visitor supports loading all stored fields, or only specific
requested fields provided from a Set
.
This is used by IndexReader.document(int)
to load a
document.
StoredFieldVisitor.Status
Constructor and Description |
---|
DocumentStoredFieldVisitor()
Load all stored fields.
|
DocumentStoredFieldVisitor(Set<String> fieldsToAdd)
Load only fields named in the provided
Set<String> . |
DocumentStoredFieldVisitor(String... fields)
Load only fields named in the provided fields.
|
Modifier and Type | Method and Description |
---|---|
void |
binaryField(FieldInfo fieldInfo,
byte[] value)
Process a binary field.
|
void |
doubleField(FieldInfo fieldInfo,
double value)
Process a double numeric field.
|
void |
floatField(FieldInfo fieldInfo,
float value)
Process a float numeric field.
|
Document |
getDocument()
Retrieve the visited document.
|
void |
intField(FieldInfo fieldInfo,
int value)
Process a int numeric field.
|
void |
longField(FieldInfo fieldInfo,
long value)
Process a long numeric field.
|
StoredFieldVisitor.Status |
needsField(FieldInfo fieldInfo)
Hook before processing a field.
|
void |
stringField(FieldInfo fieldInfo,
byte[] value)
Process a string field; the provided byte[] value is a UTF-8 encoded string value.
|
public DocumentStoredFieldVisitor(Set<String> fieldsToAdd)
Set<String>
.fieldsToAdd
- Set of fields to load, or null
(all fields).public DocumentStoredFieldVisitor(String... fields)
public DocumentStoredFieldVisitor()
public void binaryField(FieldInfo fieldInfo, byte[] value) throws IOException
StoredFieldVisitor
binaryField
in class StoredFieldVisitor
value
- newly allocated byte array with the binary contents.IOException
public void stringField(FieldInfo fieldInfo, byte[] value) throws IOException
StoredFieldVisitor
stringField
in class StoredFieldVisitor
IOException
public void intField(FieldInfo fieldInfo, int value)
StoredFieldVisitor
intField
in class StoredFieldVisitor
public void longField(FieldInfo fieldInfo, long value)
StoredFieldVisitor
longField
in class StoredFieldVisitor
public void floatField(FieldInfo fieldInfo, float value)
StoredFieldVisitor
floatField
in class StoredFieldVisitor
public void doubleField(FieldInfo fieldInfo, double value)
StoredFieldVisitor
doubleField
in class StoredFieldVisitor
public StoredFieldVisitor.Status needsField(FieldInfo fieldInfo) throws IOException
StoredFieldVisitor
StoredFieldVisitor.Status
representing whether
they need that particular field or not, or to stop processing
entirely.needsField
in class StoredFieldVisitor
IOException
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.