Class Codec
- All Implemented Interfaces:
NamedSPILoader.NamedSPI
- Direct Known Subclasses:
FilterCodec,Lucene101Codec
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 (SPI)
to resolve codec names.
If you implement your own codec, make sure that it has a no-arg constructor so SPI can load it.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionreturns a list of all available codec namesabstract CompoundFormatEncodes/decodes compound filesabstract DocValuesFormatEncodes/decodes docvaluesabstract FieldInfosFormatEncodes/decodes field infos filestatic Codeclooks up a codec by namestatic Codecexpert: returns the default codec used for newly createdIndexWriterConfigs.final StringgetName()Returns this codec's nameabstract KnnVectorsFormatEncodes/decodes numeric vector fieldsabstract LiveDocsFormatEncodes/decodes live docsabstract NormsFormatEncodes/decodes document normalization valuesabstract PointsFormatEncodes/decodes points indexabstract PostingsFormatEncodes/decodes postingsstatic voidreloadCodecs(ClassLoader classloader) Reloads the codec list from the givenClassLoader.abstract SegmentInfoFormatEncodes/decodes segment info filestatic voidsetDefault(Codec codec) expert: sets the default codec used for newly createdIndexWriterConfigs.abstract StoredFieldsFormatEncodes/decodes stored fieldsabstract TermVectorsFormatEncodes/decodes term vectorstoString()returns the codec's name.
-
Constructor Details
-
Codec
Creates a new codec.The provided name will be written into the index segment: in order to 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).
- Parameters:
name- must be all ascii alphanumeric, and less than 128 characters in length.
-
-
Method Details
-
getName
Returns this codec's name- Specified by:
getNamein interfaceNamedSPILoader.NamedSPI
-
postingsFormat
Encodes/decodes postings -
docValuesFormat
Encodes/decodes docvalues -
storedFieldsFormat
Encodes/decodes stored fields -
termVectorsFormat
Encodes/decodes term vectors -
fieldInfosFormat
Encodes/decodes field infos file -
segmentInfoFormat
Encodes/decodes segment info file -
normsFormat
Encodes/decodes document normalization values -
liveDocsFormat
Encodes/decodes live docs -
compoundFormat
Encodes/decodes compound files -
pointsFormat
Encodes/decodes points index -
knnVectorsFormat
Encodes/decodes numeric vector fields -
forName
looks up a codec by name -
availableCodecs
returns a list of all available codec names -
reloadCodecs
Reloads the codec list from the givenClassLoader. 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
expert: returns the default codec used for newly createdIndexWriterConfigs. -
setDefault
expert: sets the default codec used for newly createdIndexWriterConfigs. -
toString
returns the codec's name. Subclasses can override to provide more detail (such as parameters).
-