org.apache.lucene.codecs
Class Codec

java.lang.Object
  extended by org.apache.lucene.codecs.Codec
All Implemented Interfaces:
NamedSPILoader.NamedSPI
Direct Known Subclasses:
AppendingCodec, Lucene3xCodec, Lucene40Codec, SimpleTextCodec

public abstract class Codec
extends Object
implements NamedSPILoader.NamedSPI

Encodes/decodes an inverted index segment.

Note, when extending this class, the name (getName()) is written into the index. 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 to resolve codec names.

See Also:
ServiceLoader

Constructor Summary
Codec(String name)
           
 
Method Summary
static Set<String> availableCodecs()
          returns a list of all available codec names
abstract  DocValuesFormat docValuesFormat()
          Encodes/decodes docvalues
abstract  FieldInfosFormat fieldInfosFormat()
          Encodes/decodes field infos file
static Codec forName(String name)
          looks up a codec by name
static Codec getDefault()
          expert: returns the default codec used for newly created IndexWriterConfigs.
 String getName()
          Returns this codec's name
abstract  LiveDocsFormat liveDocsFormat()
          Encodes/decodes live docs
abstract  NormsFormat normsFormat()
          Encodes/decodes document normalization values
abstract  PostingsFormat postingsFormat()
          Encodes/decodes postings
static void reloadCodecs(ClassLoader classloader)
          Reloads the codec list from the given ClassLoader.
abstract  SegmentInfoFormat segmentInfoFormat()
          Encodes/decodes segment info file
static void setDefault(Codec codec)
          expert: sets the default codec used for newly created IndexWriterConfigs.
abstract  StoredFieldsFormat storedFieldsFormat()
          Encodes/decodes stored fields
abstract  TermVectorsFormat termVectorsFormat()
          Encodes/decodes term vectors
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Codec

public Codec(String name)
Method Detail

getName

public final String getName()
Returns this codec's name

Specified by:
getName in interface NamedSPILoader.NamedSPI

postingsFormat

public abstract PostingsFormat postingsFormat()
Encodes/decodes postings


docValuesFormat

public abstract DocValuesFormat docValuesFormat()
Encodes/decodes docvalues


storedFieldsFormat

public abstract StoredFieldsFormat storedFieldsFormat()
Encodes/decodes stored fields


termVectorsFormat

public abstract TermVectorsFormat termVectorsFormat()
Encodes/decodes term vectors


fieldInfosFormat

public abstract FieldInfosFormat fieldInfosFormat()
Encodes/decodes field infos file


segmentInfoFormat

public abstract SegmentInfoFormat segmentInfoFormat()
Encodes/decodes segment info file


normsFormat

public abstract NormsFormat normsFormat()
Encodes/decodes document normalization values


liveDocsFormat

public abstract LiveDocsFormat liveDocsFormat()
Encodes/decodes live docs


forName

public static Codec forName(String name)
looks up a codec by name


availableCodecs

public static Set<String> availableCodecs()
returns a list of all available codec names


reloadCodecs

public static void reloadCodecs(ClassLoader classloader)
Reloads the codec list from the given ClassLoader. Changes to the codecs are visible after the method ends, all iterators (availableCodecs(),...) stay consistent.

NOTE: Only new codecs are added, existing ones are never removed or replaced.

This method is expensive and should only be called for discovery of new codecs on the given classpath/classloader!


getDefault

public static Codec getDefault()
expert: returns the default codec used for newly created IndexWriterConfigs.


setDefault

public static void setDefault(Codec codec)
expert: sets the default codec used for newly created IndexWriterConfigs.


toString

public String toString()
Overrides:
toString in class Object


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