Class PerFieldDocValuesFormat
- java.lang.Object
-
- org.apache.lucene.codecs.DocValuesFormat
-
- org.apache.lucene.codecs.perfield.PerFieldDocValuesFormat
-
- All Implemented Interfaces:
NamedSPILoader.NamedSPI
public abstract class PerFieldDocValuesFormat extends DocValuesFormat
Enables per field docvalues support.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 viaDocValuesFormat.forName(String). This method uses Java'sService Provider Interfaceto 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.datfilenames would look like_1_Lucene40_0.dat.- See Also:
ServiceLoader- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Field Summary
Fields Modifier and Type Field Description static StringPER_FIELD_FORMAT_KEYFieldInfoattribute name used to store the format name for each field.static StringPER_FIELD_NAMEName of thisDocValuesFormat.static StringPER_FIELD_SUFFIX_KEYFieldInfoattribute name used to store the segment suffix name for each field.
-
Constructor Summary
Constructors Modifier Constructor Description protectedPerFieldDocValuesFormat()Sole constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description DocValuesConsumerfieldsConsumer(SegmentWriteState state)Returns aDocValuesConsumerto write docvalues to the index.DocValuesProducerfieldsProducer(SegmentReadState state)Returns aDocValuesProducerto read docvalues from the index.abstract DocValuesFormatgetDocValuesFormatForField(String field)Returns the doc values format that should be used for writing new segments offield.-
Methods inherited from class org.apache.lucene.codecs.DocValuesFormat
availableDocValuesFormats, forName, getName, reloadDocValuesFormats, toString
-
-
-
-
Field Detail
-
PER_FIELD_NAME
public static final String PER_FIELD_NAME
Name of thisDocValuesFormat.- See Also:
- Constant Field Values
-
PER_FIELD_FORMAT_KEY
public static final String PER_FIELD_FORMAT_KEY
FieldInfoattribute name used to store the format name for each field.
-
-
Method Detail
-
fieldsConsumer
public final DocValuesConsumer fieldsConsumer(SegmentWriteState state) throws IOException
Description copied from class:DocValuesFormatReturns aDocValuesConsumerto write docvalues to the index.- Specified by:
fieldsConsumerin classDocValuesFormat- Throws:
IOException
-
fieldsProducer
public final DocValuesProducer fieldsProducer(SegmentReadState state) throws IOException
Description copied from class:DocValuesFormatReturns aDocValuesProducerto 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.
- Specified by:
fieldsProducerin classDocValuesFormat- Throws:
IOException
-
getDocValuesFormatForField
public abstract DocValuesFormat getDocValuesFormatForField(String field)
Returns the doc values format that should be used for writing new segments offield.The field to format mapping is written to the index, so this method is only invoked when writing, not when reading.
-
-