Class VectorScorer

java.lang.Object
org.apache.lucene.search.VectorScorer
Direct Known Subclasses:
VectorScorer.ByteVectorScorer, VectorScorer.FloatVectorScorer

abstract class VectorScorer extends Object
Computes the similarity score between a given query vector and different document vectors. This is primarily used by KnnVectorQuery to run an exact, exhaustive search over the vectors.
  • Field Details

  • Constructor Details

  • Method Details

    • create

      static VectorScorer create(LeafReaderContext context, FieldInfo fi, float[] query) throws IOException
      Create a new vector scorer instance.
      Parameters:
      context - the reader context
      fi - the FieldInfo for the field containing document vectors
      query - the query vector to compute the similarity for
      Throws:
      IOException
    • advanceExact

      public boolean advanceExact(int doc) throws IOException
      Advance the instance to the given document ID and return true if there is a value for that document.
      Throws:
      IOException
    • score

      abstract float score() throws IOException
      Compute the similarity score for the current document.
      Throws:
      IOException