VectorScorer (Lucene 10.5.0 core API)
Description: declaration: package: org.apache.lucene.search, interface: VectorScorer

Package org.apache.lucene.search

# Interface VectorScorer

public interface VectorScorer
Computes the similarity score between a given query vector and different document vectors. This is used for exact searching and scoring

WARNING: This API is experimental and might change in incompatible ways in the next release.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static interface`
  `VectorScorer.Bulk`
  Bulk scorer interface to score multiple vectors at once

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `DEFAULT_BULK_BATCH_SIZE`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `default VectorScorer.Bulk`
  `bulk(DocIdSetIterator matchingDocs)`
  An optional bulk scorer implementation that allows bulk scoring over the provided matching docs.
  `DocIdSetIterator`
  `iterator()`
  `float`
  `score()`
  Compute the score for the current document ID.

- ## Field Details

  - ### DEFAULT_BULK_BATCH_SIZE

    static final int DEFAULT_BULK_BATCH_SIZE
    See Also:
      - Constant Field Values

- ## Method Details

  - ### score

    float score() throws IOException
    Compute the score for the current document ID.
    Returns:
      the score for the current document ID
    Throws:
      `IOException` - if an exception occurs during score computation

  - ### iterator

    DocIdSetIterator iterator()
    Returns:
      a `DocIdSetIterator` over the documents.

  - ### bulk

    default VectorScorer.Bulk bulk(DocIdSetIterator matchingDocs) throws IOException
    An optional bulk scorer implementation that allows bulk scoring over the provided matching docs. The iterator of this instance of VectorScorer should be used and iterated in conjunction with the provided matchingDocs iterator to score only the documents that are present in both iterators. If the provided matchingDocs iterator is null, then all documents should be scored. Additionally, if the iterators are unpositioned (docID() == -1), this method should position them to the first document.
    Parameters:
      `matchingDocs` - Optional filter to iterate over the documents to score
    Returns:
      a `VectorScorer.Bulk` scorer
    Throws:
      `IOException` - if an exception occurs during bulk scorer creation
    WARNING: This API is experimental and might change in incompatible ways in the next release.