|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.codecs.PostingsFormat
public abstract class PostingsFormat
Encodes/decodes terms, postings, and proximity data.
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
Service Provider Interface
(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.
ServiceLoader
Field Summary | |
---|---|
static PostingsFormat[] |
EMPTY
Zero-length PostingsFormat array. |
Constructor Summary | |
---|---|
protected |
PostingsFormat(String name)
Creates a new postings format. |
Method Summary | |
---|---|
static Set<String> |
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 |
forName(String name)
looks up a format by name |
String |
getName()
Returns this posting format's name |
static void |
reloadPostingsFormats(ClassLoader classloader)
Reloads the postings format list from the given ClassLoader . |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final PostingsFormat[] EMPTY
PostingsFormat
array.
Constructor Detail |
---|
protected PostingsFormat(String 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.Method Detail |
---|
public final String getName()
getName
in interface NamedSPILoader.NamedSPI
public abstract FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException
IOException
public abstract FieldsProducer fieldsProducer(SegmentReadState state) throws IOException
IOException
public String toString()
toString
in class Object
public static PostingsFormat forName(String name)
public static Set<String> availablePostingsFormats()
public static void reloadPostingsFormats(ClassLoader classloader)
ClassLoader
.
Changes to the postings formats are visible after the method ends, all
iterators (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!
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |