public abstract class PerFieldPostingsFormat extends PostingsFormat
Note, when extending this class, the name (PostingsFormat.getName()
) is
written into the index. In order for the field to be read, the
name must resolve to your implementation via PostingsFormat.forName(String)
.
This method uses Java's
Service Provider Interface
to resolve format names.
Files written by each posting format have an additional suffix containing the format name. For example, in a per-field configuration instead of _1.prx filenames would look like _1_Lucene40_0.prx.
ServiceLoader
Modifier and Type | Field and Description |
---|---|
static String |
PER_FIELD_FORMAT_KEY
FieldInfo attribute name used to store the
format name for each field. |
static String |
PER_FIELD_NAME
Name of this
PostingsFormat . |
static String |
PER_FIELD_SUFFIX_KEY
FieldInfo attribute name used to store the
segment suffix name for each field. |
EMPTY
Constructor and Description |
---|
PerFieldPostingsFormat()
Sole constructor.
|
Modifier and Type | Method and Description |
---|---|
FieldsConsumer |
fieldsConsumer(SegmentWriteState state)
Writes a new segment
|
FieldsProducer |
fieldsProducer(SegmentReadState state)
Reads a segment.
|
abstract PostingsFormat |
getPostingsFormatForField(String field)
Returns the postings format that should be used for writing
new segments of
field . |
availablePostingsFormats, forName, getName, reloadPostingsFormats, toString
public static final String PER_FIELD_NAME
PostingsFormat
.public static final String PER_FIELD_FORMAT_KEY
FieldInfo
attribute name used to store the
format name for each field.public final FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException
PostingsFormat
fieldsConsumer
in class PostingsFormat
IOException
public final FieldsProducer fieldsProducer(SegmentReadState state) throws IOException
PostingsFormat
fieldsProducer
in class PostingsFormat
IOException
public abstract PostingsFormat getPostingsFormatForField(String field)
field
.
The field to format mapping is written to the index, so this method is only invoked when writing, not when reading.
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.