## Package org.apache.lucene.codecs

Codecs API: API for customization of the encoding and structure of the index.

See:
Description

Class Summary
BlockTermState: Holds all state required for `PostingsReaderBase` to produce a `DocsEnum` 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 by `BlockTreeTermsReader.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.
FieldInfosFormat: Encodes/decodes `FieldInfos`
FieldInfosReader: Codec API for reading `FieldInfos`.
FieldInfosWriter: Codec API for writing `FieldInfos`.
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 documents
MappingMultiDocsAndPositionsEnum: 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 a `PostingsReaderBase` and `PostingsWriterBase`.
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 of `DocsEnum` and `DocsAndPositionsEnum` instances.
PostingsWriterBase: Extension of `PostingsConsumer` to support pluggable term dictionaries.
SegmentInfoFormat: Expert: Controls the format of the `SegmentInfo` (segment metadata file).
SegmentInfoReader: Specifies an API for classes that can read `SegmentInfo` information.
SegmentInfoWriter: Specifies an API for classes that can write out `SegmentInfo` data.
StoredFieldsFormat: Controls the format of stored fields
StoredFieldsReader: 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 vectors
TermVectorsReader: Codec API for reading term vectors:
TermVectorsWriter: Codec API for writing term vectors:

## Package org.apache.lucene.codecs Description

Codecs API: API for customization of the encoding and structure of the index.

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`

For some concrete implementations beyond Lucene's official index format, see the Codecs module.

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 `Lucene42Codec` and override `Lucene42Codec.getPostingsFormatForField(String)` to return your custom postings format.

Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.