Class HnswCodec

  • All Implemented Interfaces:
    org.apache.lucene.util.NamedSPILoader.NamedSPI

    public class HnswCodec
    extends org.apache.lucene.codecs.FilterCodec
    Extend the Lucene 9.5 index format The major change here is to allow custom: @link{org.apache.lucene.codecs.KnnVectorsFormat}
    See Also:
    package documentation for file format details.
    • Field Summary

      • Fields inherited from class org.apache.lucene.codecs.FilterCodec

        delegate
    • Constructor Summary

      Constructors 
      Constructor Description
      HnswCodec​(org.apache.lucene.codecs.lucene95.Lucene95Codec.Mode mode, org.apache.lucene.codecs.KnnVectorsFormat defaultKnnVectorsFormat)
      Instantiates a new codec, specifying the stored fields compression mode to use.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.lucene.codecs.DocValuesFormat docValuesFormat()  
      org.apache.lucene.codecs.DocValuesFormat getDocValuesFormatForField​(String field)
      Returns the docvalues format that should be used for writing new segments of field .
      org.apache.lucene.codecs.KnnVectorsFormat getKnnVectorsFormatForField​(String field)
      Returns the vectors format that should be used for writing new segments of field
      org.apache.lucene.codecs.PostingsFormat getPostingsFormatForField​(String field)
      Returns the postings format that should be used for writing new segments of field.
      org.apache.lucene.codecs.KnnVectorsFormat knnVectorsFormat()  
      org.apache.lucene.codecs.PointsFormat pointsFormat()  
      org.apache.lucene.codecs.PostingsFormat postingsFormat()  
      • Methods inherited from class org.apache.lucene.codecs.FilterCodec

        compoundFormat, fieldInfosFormat, liveDocsFormat, normsFormat, segmentInfoFormat, storedFieldsFormat, termVectorsFormat
      • Methods inherited from class org.apache.lucene.codecs.Codec

        availableCodecs, forName, getDefault, getName, reloadCodecs, setDefault, toString
    • Constructor Detail

      • HnswCodec

        public HnswCodec​(org.apache.lucene.codecs.lucene95.Lucene95Codec.Mode mode,
                         org.apache.lucene.codecs.KnnVectorsFormat defaultKnnVectorsFormat)
        Instantiates a new codec, specifying the stored fields compression mode to use.
        Parameters:
        mode - stored fields compression mode to use for newly flushed/merged segments.
    • Method Detail

      • postingsFormat

        public final org.apache.lucene.codecs.PostingsFormat postingsFormat()
        Overrides:
        postingsFormat in class org.apache.lucene.codecs.FilterCodec
      • pointsFormat

        public final org.apache.lucene.codecs.PointsFormat pointsFormat()
        Overrides:
        pointsFormat in class org.apache.lucene.codecs.FilterCodec
      • knnVectorsFormat

        public final org.apache.lucene.codecs.KnnVectorsFormat knnVectorsFormat()
        Overrides:
        knnVectorsFormat in class org.apache.lucene.codecs.FilterCodec
      • getPostingsFormatForField

        public org.apache.lucene.codecs.PostingsFormat getPostingsFormatForField​(String field)
        Returns the postings format that should be used for writing new segments of field.

        The default implementation always returns "Lucene90".

        WARNING: if you subclass, you are responsible for index backwards compatibility: future version of Lucene are only guaranteed to be able to read the default implementation,

      • getDocValuesFormatForField

        public org.apache.lucene.codecs.DocValuesFormat getDocValuesFormatForField​(String field)
        Returns the docvalues format that should be used for writing new segments of field .

        The default implementation always returns "Lucene90".

        WARNING: if you subclass, you are responsible for index backwards compatibility: future version of Lucene are only guaranteed to be able to read the default implementation.

      • getKnnVectorsFormatForField

        public org.apache.lucene.codecs.KnnVectorsFormat getKnnVectorsFormatForField​(String field)
        Returns the vectors format that should be used for writing new segments of field

        The default implementation always returns "Lucene95".

        WARNING: if you subclass, you are responsible for index backwards compatibility: future version of Lucene are only guaranteed to be able to read the default implementation.

      • docValuesFormat

        public final org.apache.lucene.codecs.DocValuesFormat docValuesFormat()
        Overrides:
        docValuesFormat in class org.apache.lucene.codecs.FilterCodec