SpanScorer (Lucene 10.5.0 queries API)
Description: declaration: package: org.apache.lucene.queries.spans, class: SpanScorer

Package org.apache.lucene.queries.spans

# Class SpanScorer

java.lang.Object
org.apache.lucene.search.Scorable
org.apache.lucene.search.Scorer
org.apache.lucene.queries.spans.SpanScorer

public class SpanScorer extends Scorer
A basic `Scorer` over `Spans`.

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

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class org.apache.lucene.search.Scorable

  `Scorable.ChildScorable`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final NumericDocValues`
  `norms`
  `protected final Similarity.SimScorer`
  `scorer`
  `protected final Spans`
  `spans`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SpanScorer(Spans spans, Similarity.SimScorer scorer, NumericDocValues norms)`
  Sole constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `docID()`
  `float`
  `getMaxScore(int upTo)`
  `Spans`
  `getSpans()`
  return the Spans for this Scorer *
  `DocIdSetIterator`
  `iterator()`
  `final float`
  `score()`
  `protected float`
  `scoreCurrentDoc()`
  Score the current doc.
  `protected final void`
  `setFreqCurrentDoc()`
  Sets `freq` for the current document.
  `TwoPhaseIterator`
  `twoPhaseIterator()`

  ### Methods inherited from class org.apache.lucene.search.Scorer

  `advanceShallow, nextDocsAndScores`

  ### Methods inherited from class org.apache.lucene.search.Scorable

  `getChildren, setMinCompetitiveScore, smoothingScore`

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

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

- ## Field Details

  - ### spans

    protected final Spans spans

  - ### scorer

    protected final Similarity.SimScorer scorer

  - ### norms

    protected final NumericDocValues norms

- ## Constructor Details

  - ### SpanScorer

    public SpanScorer(Spans spans, Similarity.SimScorer scorer, NumericDocValues norms)
    Sole constructor.

- ## Method Details

  - ### getSpans

    public Spans getSpans()
    return the Spans for this Scorer *

  - ### docID

    public int docID()
    Specified by:
      `docID` in class `Scorer`

  - ### iterator

    public DocIdSetIterator iterator()
    Specified by:
      `iterator` in class `Scorer`

  - ### twoPhaseIterator

    public TwoPhaseIterator twoPhaseIterator()
    Overrides:
      `twoPhaseIterator` in class `Scorer`

  - ### scoreCurrentDoc

    protected float scoreCurrentDoc() throws IOException
    Score the current doc. The default implementation scores the doc with the similarity using the slop-adjusted `freq`.
    Throws:
      `IOException`

  - ### setFreqCurrentDoc

    protected final void setFreqCurrentDoc() throws IOException
    Sets `freq` for the current document.

    This will be called at most once per document.

    Throws:
      `IOException`

  - ### score

    public final float score() throws IOException
    Specified by:
      `score` in class `Scorable`
    Throws:
      `IOException`

  - ### getMaxScore

    public float getMaxScore(int upTo) throws IOException
    Specified by:
      `getMaxScore` in class `Scorer`
    Throws:
      `IOException`