protected class StoredFieldsWriter.MergeVisitor extends StoredFieldVisitor implements IndexableField
Use like this:
MergeVisitor visitor = new MergeVisitor(mergeState, readerIndex);
for (...) {
startDocument();
storedFieldsReader.visitDocument(docID, visitor);
finishDocument();
}
StoredFieldVisitor.Status| Constructor and Description |
|---|
StoredFieldsWriter.MergeVisitor(MergeState mergeState,
int readerIndex)
Create new merge visitor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
binaryField(FieldInfo fieldInfo,
byte[] value)
Process a binary field.
|
BytesRef |
binaryValue()
Non-null if this field has a binary value
|
float |
boost()
Returns the field's index-time boost.
|
void |
doubleField(FieldInfo fieldInfo,
double value)
Process a double numeric field.
|
IndexableFieldType |
fieldType()
IndexableFieldType describing the properties
of this field. |
void |
floatField(FieldInfo fieldInfo,
float value)
Process a float numeric field.
|
void |
intField(FieldInfo fieldInfo,
int value)
Process a int numeric field.
|
void |
longField(FieldInfo fieldInfo,
long value)
Process a long numeric field.
|
String |
name()
Field name
|
StoredFieldVisitor.Status |
needsField(FieldInfo fieldInfo)
Hook before processing a field.
|
Number |
numericValue()
Non-null if this field has a numeric value
|
Reader |
readerValue()
Non-null if this field has a Reader value
|
void |
stringField(FieldInfo fieldInfo,
byte[] value)
Process a string field; the provided byte[] value is a UTF-8 encoded string value.
|
String |
stringValue()
Non-null if this field has a string value
|
TokenStream |
tokenStream(Analyzer analyzer,
TokenStream reuse)
Creates the TokenStream used for indexing this field.
|
public StoredFieldsWriter.MergeVisitor(MergeState mergeState, int readerIndex)
public void binaryField(FieldInfo fieldInfo, byte[] value) throws IOException
StoredFieldVisitorbinaryField in class StoredFieldVisitorvalue - newly allocated byte array with the binary contents.IOExceptionpublic void stringField(FieldInfo fieldInfo, byte[] value) throws IOException
StoredFieldVisitorstringField in class StoredFieldVisitorIOExceptionpublic void intField(FieldInfo fieldInfo, int value) throws IOException
StoredFieldVisitorintField in class StoredFieldVisitorIOExceptionpublic void longField(FieldInfo fieldInfo, long value) throws IOException
StoredFieldVisitorlongField in class StoredFieldVisitorIOExceptionpublic void floatField(FieldInfo fieldInfo, float value) throws IOException
StoredFieldVisitorfloatField in class StoredFieldVisitorIOExceptionpublic void doubleField(FieldInfo fieldInfo, double value) throws IOException
StoredFieldVisitordoubleField in class StoredFieldVisitorIOExceptionpublic StoredFieldVisitor.Status needsField(FieldInfo fieldInfo) throws IOException
StoredFieldVisitorStoredFieldVisitor.Status representing whether
they need that particular field or not, or to stop processing
entirely.needsField in class StoredFieldVisitorIOExceptionpublic String name()
IndexableFieldname in interface IndexableFieldpublic IndexableFieldType fieldType()
IndexableFieldIndexableFieldType describing the properties
of this field.fieldType in interface IndexableFieldpublic BytesRef binaryValue()
IndexableFieldbinaryValue in interface IndexableFieldpublic String stringValue()
IndexableFieldstringValue in interface IndexableFieldpublic Number numericValue()
IndexableFieldnumericValue in interface IndexableFieldpublic Reader readerValue()
IndexableFieldreaderValue in interface IndexableFieldpublic float boost()
IndexableFieldOnly fields can have an index-time boost, if you want to simulate a "document boost", then you must pre-multiply it across all the relevant fields yourself.
The boost is used to compute the norm factor for the field. By
default, in the Similarity.computeNorm(FieldInvertState) method,
the boost value is multiplied by the length normalization factor and then
rounded by DefaultSimilarity.encodeNormValue(float) before it is stored in the
index. One should attempt to ensure that this product does not overflow
the range of that encoding.
It is illegal to return a boost other than 1.0f for a field that is not
indexed (IndexableFieldType.indexOptions() is IndexOptions.NONE) or
omits normalization values (IndexableFieldType.omitNorms() returns true).
boost in interface IndexableFieldSimilarity.computeNorm(FieldInvertState),
DefaultSimilarity.encodeNormValue(float)public TokenStream tokenStream(Analyzer analyzer, TokenStream reuse) throws IOException
IndexableFieldtokenStream in interface IndexableFieldanalyzer - Analyzer that should be used to create the TokenStreams fromreuse - TokenStream for a previous instance of this field name. This allows
custom field types (like StringField and NumericField) that do not use
the analyzer to still have good performance. Note: the passed-in type
may be inappropriate, for example if you mix up different types of Fields
for the same field name. So its the responsibility of the implementation to
check.IOException - Can be thrown while creating the TokenStreamCopyright © 2000-2015 Apache Software Foundation. All Rights Reserved.