Package org.apache.lucene.document
Class DocumentStoredFieldVisitor
- java.lang.Object
 - 
- org.apache.lucene.index.StoredFieldVisitor
 - 
- org.apache.lucene.document.DocumentStoredFieldVisitor
 
 
 
- 
public class DocumentStoredFieldVisitor extends StoredFieldVisitor
AStoredFieldVisitorthat creates aDocumentcontaining all stored fields, or only specific requested fields provided toDocumentStoredFieldVisitor(Set).This is used by
IndexReader.document(int)to load a document. 
- 
- 
Nested Class Summary
- 
Nested classes/interfaces inherited from class org.apache.lucene.index.StoredFieldVisitor
StoredFieldVisitor.Status 
 - 
 
- 
Constructor Summary
Constructors Constructor Description DocumentStoredFieldVisitor()Load all stored fields.DocumentStoredFieldVisitor(java.lang.String... fields)Load only fields named in the provided fields.DocumentStoredFieldVisitor(java.util.Set<java.lang.String> fieldsToAdd)Load only fields named in the providedSet<String>. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbinaryField(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.DocumentgetDocument()Retrieve the visited document.voidintField(FieldInfo fieldInfo, int value)Process a int numeric field.voidlongField(FieldInfo fieldInfo, long value)Process a long numeric field.StoredFieldVisitor.StatusneedsField(FieldInfo fieldInfo)Hook before processing a field.voidstringField(FieldInfo fieldInfo, java.lang.String value)Process a string field 
 - 
 
- 
- 
Constructor Detail
- 
DocumentStoredFieldVisitor
public DocumentStoredFieldVisitor(java.util.Set<java.lang.String> fieldsToAdd)
Load only fields named in the providedSet<String>.- Parameters:
 fieldsToAdd- Set of fields to load, ornull(all fields).
 
- 
DocumentStoredFieldVisitor
public DocumentStoredFieldVisitor(java.lang.String... fields)
Load only fields named in the provided fields. 
- 
DocumentStoredFieldVisitor
public DocumentStoredFieldVisitor()
Load all stored fields. 
 - 
 
- 
Method Detail
- 
binaryField
public void binaryField(FieldInfo fieldInfo, byte[] value) throws java.io.IOException
Description copied from class:StoredFieldVisitorProcess a binary field.- Overrides:
 binaryFieldin classStoredFieldVisitorvalue- newly allocated byte array with the binary contents.- Throws:
 java.io.IOException
 
- 
stringField
public void stringField(FieldInfo fieldInfo, java.lang.String value) throws java.io.IOException
Description copied from class:StoredFieldVisitorProcess a string field- Overrides:
 stringFieldin classStoredFieldVisitor- Throws:
 java.io.IOException
 
- 
intField
public void intField(FieldInfo fieldInfo, int value)
Description copied from class:StoredFieldVisitorProcess a int numeric field.- Overrides:
 intFieldin classStoredFieldVisitor
 
- 
longField
public void longField(FieldInfo fieldInfo, long value)
Description copied from class:StoredFieldVisitorProcess a long numeric field.- Overrides:
 longFieldin classStoredFieldVisitor
 
- 
floatField
public void floatField(FieldInfo fieldInfo, float value)
Description copied from class:StoredFieldVisitorProcess a float numeric field.- Overrides:
 floatFieldin classStoredFieldVisitor
 
- 
doubleField
public void doubleField(FieldInfo fieldInfo, double value)
Description copied from class:StoredFieldVisitorProcess a double numeric field.- Overrides:
 doubleFieldin classStoredFieldVisitor
 
- 
needsField
public StoredFieldVisitor.Status needsField(FieldInfo fieldInfo) throws java.io.IOException
Description copied from class:StoredFieldVisitorHook 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.- Specified by:
 needsFieldin classStoredFieldVisitor- Throws:
 java.io.IOException
 
- 
getDocument
public Document getDocument()
Retrieve the visited document.- Returns:
 - Document populated with stored fields. Note that only the stored information in the field instances is valid, data such as boosts, indexing options, term vector options, etc is not set.
 
 
 - 
 
 -