org.apache.lucene.codecs.perfield
Class PerFieldPostingsFormat
java.lang.Object
org.apache.lucene.codecs.PostingsFormat
org.apache.lucene.codecs.perfield.PerFieldPostingsFormat
- All Implemented Interfaces:
- NamedSPILoader.NamedSPI
public abstract class PerFieldPostingsFormat
- extends PostingsFormat
Enables per field format support.
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.
- See Also:
ServiceLoader
- WARNING: This API is experimental and might change in incompatible ways in the next release.
PER_FIELD_NAME
public static final String PER_FIELD_NAME
- See Also:
- Constant Field Values
PER_FIELD_FORMAT_KEY
public static final String PER_FIELD_FORMAT_KEY
PER_FIELD_SUFFIX_KEY
public static final String PER_FIELD_SUFFIX_KEY
PerFieldPostingsFormat
public PerFieldPostingsFormat()
fieldsConsumer
public FieldsConsumer fieldsConsumer(SegmentWriteState state)
throws IOException
- Description copied from class:
PostingsFormat
- Writes a new segment
- Specified by:
fieldsConsumer
in class PostingsFormat
- Throws:
IOException
fieldsProducer
public FieldsProducer fieldsProducer(SegmentReadState state)
throws IOException
- Description copied from class:
PostingsFormat
- Reads a segment. 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:
fieldsProducer
in class PostingsFormat
- Throws:
IOException
getPostingsFormatForField
public abstract PostingsFormat getPostingsFormatForField(String field)
Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.