CompletionScorer (Lucene 10.5.0 suggest API)
Description: declaration: package: org.apache.lucene.search.suggest.document, class: CompletionScorer

Package org.apache.lucene.search.suggest.document

# Class CompletionScorer

java.lang.Object
org.apache.lucene.search.BulkScorer
org.apache.lucene.search.suggest.document.CompletionScorer

public class CompletionScorer extends BulkScorer
Expert: Responsible for executing the query against an appropriate suggester and collecting the results via a collector.

`score(LeafCollector, Bits, int, int)` is called for each leaf reader.

`accept(int,Bits)` and `score(float, float)` is called for every matched completion (i.e. document)

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

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final CompletionWeight`
  `weight`
  weight that created this scorer

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `CompletionScorer(CompletionWeight weight, NRTSuggester suggester, LeafReader reader, Bits filterDocs, boolean filtered, Automaton automaton)`
  Creates a scorer for a field-specific `suggester` scoped by `acceptDocs`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final boolean`
  `accept(int docID, Bits liveDocs)`
  Returns true if a document with `docID` is accepted, false if the docID maps to a deleted document or has been filtered out
  `long`
  `cost()`
  `float`
  `score(float weight, float boost)`
  Returns the score for a matched completion based on the query time boost and the index time weight.
  `int`
  `score(LeafCollector collector, Bits acceptDocs, int min, int max)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### weight

    protected final CompletionWeight weight
    weight that created this scorer

- ## Constructor Details

  - ### CompletionScorer

    protected CompletionScorer(CompletionWeight weight, NRTSuggester suggester, LeafReader reader, Bits filterDocs, boolean filtered, Automaton automaton) throws IOException
    Creates a scorer for a field-specific `suggester` scoped by `acceptDocs`
    Throws:
      `IOException`

- ## Method Details

  - ### score

    public int score(LeafCollector collector, Bits acceptDocs, int min, int max) throws IOException
    Specified by:
      `score` in class `BulkScorer`
    Throws:
      `IOException`

  - ### cost

    public long cost()
    Specified by:
      `cost` in class `BulkScorer`

  - ### accept

    public final boolean accept(int docID, Bits liveDocs)
    Returns true if a document with `docID` is accepted, false if the docID maps to a deleted document or has been filtered out
    Parameters:
      `liveDocs` - the `Bits` representing live docs, or possibly `null` if all docs are live

  - ### score

    public float score(float weight, float boost)
    Returns the score for a matched completion based on the query time boost and the index time weight.