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 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. |
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(java.lang.String field)
Returns the postings format that should be used for writing
new segments of
field. |
availablePostingsFormats, forName, getName, reloadPostingsFormats, toStringpublic 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 FieldsConsumer fieldsConsumer(SegmentWriteState state) throws java.io.IOException
PostingsFormatfieldsConsumer in class PostingsFormatjava.io.IOExceptionpublic final FieldsProducer fieldsProducer(SegmentReadState state) throws java.io.IOException
PostingsFormatfieldsProducer in class PostingsFormatjava.io.IOExceptionpublic abstract PostingsFormat getPostingsFormatForField(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.
Copyright © 2000–2025 The Apache Software Foundation. All rights reserved.