Class TSDBSyntheticIdCodec
- All Implemented Interfaces:
org.apache.lucene.util.NamedSPILoader.NamedSPI
The role of this codec is to ensure that no inverted index is created when indexing a document id in Lucene, while allowing the usage of terms and postings on the field (now called a "synthetic _id" field) as if it was backed by an in inverted index.
In order to do this, it wraps the default postings format with an implementation that throws an IllegalArgumentException if
a Lucene field with the name _id produces terms (ie, has postings) during indexing. It also overwrites the FieldInfos
to ensure that the _id field information has the IndexOptions.NONE option when written to disk. It also changes this
IndexOptions.NONE option back to IndexOptions.DOCS when reading the FieldInfos during the opening of a new
segment core reader. This allows to use a Lucene term dictionary on top of a synthetic _id field that does not have corresponding
postings files on disk. Finally, the codec injects additional FieldInfos attributes so that Lucene's
PerFieldPostingsFormat correctly instantiates a TSDBSyntheticIdPostingsFormat to access the term and postings of the
synthetic _id field.
-
Field Summary
Fields inherited from class org.apache.lucene.codecs.FilterCodec
delegate -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal org.apache.lucene.codecs.FieldInfosFormatorg.apache.lucene.codecs.PostingsFormatMethods inherited from class org.apache.lucene.codecs.FilterCodec
compoundFormat, docValuesFormat, knnVectorsFormat, liveDocsFormat, normsFormat, pointsFormat, segmentInfoFormat, storedFieldsFormat, termVectorsFormatMethods inherited from class org.apache.lucene.codecs.Codec
availableCodecs, forName, getDefault, getName, reloadCodecs, setDefault, toString
-
Constructor Details
-
TSDBSyntheticIdCodec
-
-
Method Details
-
fieldInfosFormat
public final org.apache.lucene.codecs.FieldInfosFormat fieldInfosFormat()- Overrides:
fieldInfosFormatin classorg.apache.lucene.codecs.FilterCodec
-
postingsFormat
public org.apache.lucene.codecs.PostingsFormat postingsFormat()- Overrides:
postingsFormatin classorg.apache.lucene.codecs.FilterCodec
-