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

Package org.apache.lucene.queries.spans

# Class SpanQuery

java.lang.Object
org.apache.lucene.search.Query
org.apache.lucene.queries.spans.SpanQuery

Direct Known Subclasses:
  `FieldMaskingSpanQuery`, `PayloadScoreQuery`, `SpanContainingQuery`, `SpanMultiTermQueryWrapper`, `SpanNearQuery`, `SpanNotQuery`, `SpanOrQuery`, `SpanPayloadCheckQuery`, `SpanPositionCheckQuery`, `SpanTermQuery`, `SpanWithinQuery`

public abstract class SpanQuery extends Query
Base class for span-based queries.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SpanQuery()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract SpanWeight`
  `createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost)`
  `abstract String`
  `getField()`
  Returns the name of the field matched by this query.
  `static Map<Term,TermStates>`
  `getTermStates(Collection<SpanWeight> weights)`
  Build a map of terms to `TermStates`, for use in constructing SpanWeights
  `static Map<Term,TermStates>`
  `getTermStates(SpanWeight... weights)`
  Build a map of terms to `TermStates`, for use in constructing SpanWeights

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

  `classHash, equals, hashCode, rewrite, sameClassAs, toString, toString, visit`

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

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### SpanQuery

    public SpanQuery()

- ## Method Details

  - ### getField

    public abstract String getField()
    Returns the name of the field matched by this query.

  - ### createWeight

    public abstract SpanWeight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException
    Overrides:
      `createWeight` in class `Query`
    Throws:
      `IOException`

  - ### getTermStates

    public static Map<Term,TermStates> getTermStates(SpanWeight... weights)
    Build a map of terms to `TermStates`, for use in constructing SpanWeights
    NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

  - ### getTermStates

    public static Map<Term,TermStates> getTermStates(Collection<SpanWeight> weights)
    Build a map of terms to `TermStates`, for use in constructing SpanWeights
    NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.