public abstract class PerFieldDocValuesFormat extends DocValuesFormat
Note, when extending this class, the name (DocValuesFormat.getName()
) is
written into the index. In order for the field to be read, the
name must resolve to your implementation via DocValuesFormat.forName(String)
.
This method uses Java's
Service Provider Interface
to resolve format names.
Files written by each docvalues format have an additional suffix containing the format name. For example, in a per-field configuration instead of _1.dat filenames would look like _1_Lucene40_0.dat.
ServiceLoader
Modifier and Type | Class and Description |
---|---|
(package private) static class |
PerFieldDocValuesFormat.ConsumerAndSuffix |
private class |
PerFieldDocValuesFormat.FieldsReader |
private class |
PerFieldDocValuesFormat.FieldsWriter |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PER_FIELD_FORMAT_KEY
FieldInfo attribute name used to store the
format name for each field. |
static java.lang.String |
PER_FIELD_NAME
Name of this
PostingsFormat . |
static java.lang.String |
PER_FIELD_SUFFIX_KEY
FieldInfo attribute name used to store the
segment suffix name for each field. |
Constructor and Description |
---|
PerFieldDocValuesFormat()
Sole constructor.
|
Modifier and Type | Method and Description |
---|---|
DocValuesConsumer |
fieldsConsumer(SegmentWriteState state)
Returns a
DocValuesConsumer to write docvalues to the
index. |
DocValuesProducer |
fieldsProducer(SegmentReadState state)
Returns a
DocValuesProducer to read docvalues from the index. |
abstract DocValuesFormat |
getDocValuesFormatForField(java.lang.String field)
Returns the doc values format that should be used for writing
new segments of
field . |
(package private) static java.lang.String |
getFullSegmentSuffix(java.lang.String outerSegmentSuffix,
java.lang.String segmentSuffix) |
(package private) static java.lang.String |
getSuffix(java.lang.String formatName,
java.lang.String suffix) |
availableDocValuesFormats, forName, getName, reloadDocValuesFormats, toString
public static final java.lang.String PER_FIELD_NAME
PostingsFormat
.public static final java.lang.String PER_FIELD_FORMAT_KEY
FieldInfo
attribute name used to store the
format name for each field.public static final java.lang.String PER_FIELD_SUFFIX_KEY
FieldInfo
attribute name used to store the
segment suffix name for each field.public final DocValuesConsumer fieldsConsumer(SegmentWriteState state) throws java.io.IOException
DocValuesFormat
DocValuesConsumer
to write docvalues to the
index.fieldsConsumer
in class DocValuesFormat
java.io.IOException
static java.lang.String getSuffix(java.lang.String formatName, java.lang.String suffix)
static java.lang.String getFullSegmentSuffix(java.lang.String outerSegmentSuffix, java.lang.String segmentSuffix)
public final DocValuesProducer fieldsProducer(SegmentReadState state) throws java.io.IOException
DocValuesFormat
DocValuesProducer
to read docvalues from the index.
NOTE: by the time this call returns, it must hold open any files it will need to use; else, those files may be deleted. Additionally, required files may be deleted during the execution of this call before there is a chance to open them. Under these circumstances an IOException should be thrown by the implementation. IOExceptions are expected and will automatically cause a retry of the segment opening logic with the newly revised segments.
fieldsProducer
in class DocValuesFormat
java.io.IOException
public abstract DocValuesFormat getDocValuesFormatForField(java.lang.String field)
field
.
The field to format mapping is written to the index, so this method is only invoked when writing, not when reading.