Package org.apache.lucene.codecs
The Codec API allows you to customise the way the following pieces of index information are stored:
- Postings lists - see
PostingsFormat
- DocValues - see
DocValuesFormat
- Stored fields - see
StoredFieldsFormat
- Term vectors - see
TermVectorsFormat
- FieldInfos - see
FieldInfosFormat
- SegmentInfo - see
SegmentInfoFormat
- Norms - see
NormsFormat
- Live documents - see
LiveDocsFormat
Codecs are identified by name through the Java Service Provider Interface. To create your own codec, extend
Codec
and pass the new codec's name to the super() constructor:
public class MyCodec extends Codec { public MyCodec() { super("MyCodecName"); } ... }You will need to register the Codec class so that the
ServiceLoader
can find it, by including a
META-INF/services/org.apache.lucene.codecs.Codec file on your classpath that contains the package-qualified
name of your codec.
If you just want to customise the PostingsFormat
, or use different postings
formats for different fields, then you can register your custom postings format in the same way (in
META-INF/services/org.apache.lucene.codecs.PostingsFormat), and then extend the default
Lucene46Codec
and override
Lucene46Codec.getPostingsFormatForField(String)
to return your custom
postings format.
Similarly, if you just want to customise the DocValuesFormat
per-field, have
a look at Lucene46Codec.getDocValuesFormatForField(String)
.
-
Class Summary Class Description BlockTermState Holds all state required forPostingsReaderBase
to produce aDocsEnum
without re-seeking the terms dict.BlockTreeTermsReader A block-based terms index and dictionary that assigns terms to variable length blocks according to how they share prefixes.BlockTreeTermsReader.Stats BlockTree statistics for a single field returned byBlockTreeTermsReader.FieldReader.computeStats()
.BlockTreeTermsWriter Block-based terms index and dictionary writer.Codec Encodes/decodes an inverted index segment.CodecUtil Utility class for reading and writing versioned headers.DocValuesConsumer Abstract API that consumes numeric, binary and sorted docvalues.DocValuesFormat Encodes/decodes per-document values.DocValuesProducer Abstract API that produces numeric, binary and sorted docvalues.DocValuesProducer.SortedDocsWithField A simple implementation ofDocValuesProducer.getDocsWithField(org.apache.lucene.index.FieldInfo)
that returnstrue
if a document has an ordinal >= 0DocValuesProducer.SortedSetDocsWithField A simple implementation ofDocValuesProducer.getDocsWithField(org.apache.lucene.index.FieldInfo)
that returnstrue
if a document has any ordinals.FieldInfosFormat Encodes/decodesFieldInfos
FieldInfosReader Codec API for readingFieldInfos
.FieldInfosWriter Codec API for writingFieldInfos
.FieldsConsumer Abstract API that consumes terms, doc, freq, prox, offset and payloads postings.FieldsProducer Abstract API that produces terms, doc, freq, prox, offset and payloads postings.FilterCodec A codec that forwards all its method calls to another codec.LiveDocsFormat Format for live/deleted documentsMappingMultiDocsAndPositionsEnum Exposes flex API, merged from flex API of sub-segments, remapping docIDs (this is used for segment merging).MappingMultiDocsEnum Exposes flex API, merged from flex API of sub-segments, remapping docIDs (this is used for segment merging).MultiLevelSkipListReader This abstract class reads skip lists with multiple levels.MultiLevelSkipListWriter This abstract class writes skip lists with multiple levels.NormsFormat Encodes/decodes per-document score normalization values.PostingsBaseFormat Provides aPostingsReaderBase
andPostingsWriterBase
.PostingsConsumer Abstract API that consumes postings for an individual term.PostingsFormat Encodes/decodes terms, postings, and proximity data.PostingsReaderBase The core terms dictionaries (BlockTermsReader, BlockTreeTermsReader) interact with a single instance of this class to manage creation ofDocsEnum
andDocsAndPositionsEnum
instances.PostingsWriterBase Extension ofPostingsConsumer
to support pluggable term dictionaries.SegmentInfoFormat Expert: Controls the format of theSegmentInfo
(segment metadata file).SegmentInfoReader Specifies an API for classes that can readSegmentInfo
information.SegmentInfoWriter Specifies an API for classes that can write outSegmentInfo
data.StoredFieldsFormat Controls the format of stored fieldsStoredFieldsReader Codec API for reading stored fields.StoredFieldsWriter Codec API for writing stored fields:TermsConsumer Abstract API that consumes terms for an individual field.TermStats Holder for per-term statistics.TermVectorsFormat Controls the format of term vectorsTermVectorsReader Codec API for reading term vectors:TermVectorsWriter Codec API for writing term vectors: