Class Codec
- All Implemented Interfaces:
NamedSPILoader.NamedSPI
- Direct Known Subclasses:
FilterCodec
,Lucene91Codec
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
-
Method Summary
Modifier and TypeMethodDescriptionreturns a list of all available codec namesabstract CompoundFormat
Encodes/decodes compound filesabstract DocValuesFormat
Encodes/decodes docvaluesabstract FieldInfosFormat
Encodes/decodes field infos filestatic Codec
looks up a codec by namestatic Codec
expert: returns the default codec used for newly createdIndexWriterConfig
s.final String
getName()
Returns this codec's nameabstract KnnVectorsFormat
Encodes/decodes numeric vector fieldsabstract LiveDocsFormat
Encodes/decodes live docsabstract NormsFormat
Encodes/decodes document normalization valuesabstract PointsFormat
Encodes/decodes points indexabstract PostingsFormat
Encodes/decodes postingsstatic void
reloadCodecs
(ClassLoader classloader) Reloads the codec list from the givenClassLoader
.abstract SegmentInfoFormat
Encodes/decodes segment info filestatic void
setDefault
(Codec codec) expert: sets the default codec used for newly createdIndexWriterConfig
s.abstract StoredFieldsFormat
Encodes/decodes stored fieldsabstract TermVectorsFormat
Encodes/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:
getName
in 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 createdIndexWriterConfig
s. -
setDefault
expert: sets the default codec used for newly createdIndexWriterConfig
s. -
toString
returns the codec's name. Subclasses can override to provide more detail (such as parameters).
-