public abstract class PostingsFormat extends implements NamedSPILoader.NamedSPI
Note, when extending this class, the name (getName()
) may
written into the index in certain configurations. In order for the segment
to be read, the name must resolve to your implementation via forName(String)
.
This method uses Java's
(SPI) to resolve format names.
If you implement your own format, make sure that it has a no-arg constructor so SPI can load it.
Modifier and Type | Field and Description |
---|---|
static PostingsFormat[] |
EMPTY
Zero-length
PostingsFormat array. |
Modifier | Constructor and Description |
---|---|
protected |
name)
Creates a new postings format.
|
Modifier and Type | Method and Description |
---|---|
static <> |
availablePostingsFormats()
returns a list of all available format names
|
abstract FieldsConsumer |
fieldsConsumer(SegmentWriteState state)
Writes a new segment
|
abstract FieldsProducer |
fieldsProducer(SegmentReadState state)
Reads a segment.
|
static PostingsFormat |
name)
looks up a format by name
|
|
getName()
Returns this posting format's name
|
static void |
classloader)
Reloads the postings format list from the given .
|
|
toString() |
public static final PostingsFormat[] EMPTY
PostingsFormat
array.protected PostingsFormat( name)
The provided name will be written into the index segment in some configurations
(such as when using PerFieldPostingsFormat
): in such configurations,
for the segment to be read this class should be registered with Java's
SPI mechanism (registered in META-INF/ of your jar file, etc).
name
- must be all ascii alphanumeric, and less than 128 characters in length.public final getName()
getName
in interface NamedSPILoader.NamedSPI
public abstract FieldsConsumer fieldsConsumer(SegmentWriteState state) throws
public abstract FieldsProducer fieldsProducer(SegmentReadState state) throws
public toString()
in class
public static name)
public static <> availablePostingsFormats()
public static void reloadPostingsFormats( classloader)
availablePostingsFormats()
,...) stay consistent.
NOTE: Only new postings formats are added, existing ones are never removed or replaced.
This method is expensive and should only be called for discovery of new postings formats on the given classpath/classloader!
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.