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

Package org.apache.lucene.queries.payloads

# Class SpanPayloadCheckQuery

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

public class SpanPayloadCheckQuery extends SpanQuery
Only return those matches that have a specific payload at the given position.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `SpanPayloadCheckQuery.MatchOperation`
  The payload type.
  `static enum`
  `SpanPayloadCheckQuery.PayloadType`
  The payload type.
  `class`
  `SpanPayloadCheckQuery.SpanPayloadCheckWeight`
  Weight that pulls its Spans using a PayloadSpanCollector

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final SpanQuery`
  `match`
  `protected final SpanPayloadCheckQuery.MatchOperation`
  `operation`
  `protected final List<BytesRef>`
  `payloadToMatch`
  `protected final SpanPayloadCheckQuery.PayloadType`
  `payloadType`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SpanPayloadCheckQuery(SpanQuery match, List<BytesRef> payloadToMatch)`
  `SpanPayloadCheckQuery(SpanQuery match, List<BytesRef> payloadToMatch, SpanPayloadCheckQuery.PayloadType payloadType, SpanPayloadCheckQuery.MatchOperation operation)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `SpanWeight`
  `createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost)`
  `boolean`
  `equals(Object other)`
  `String`
  `getField()`
  Returns the name of the field matched by this query.
  `int`
  `hashCode()`
  `Query`
  `rewrite(IndexSearcher indexSearcher)`
  `String`
  `toString(String field)`
  `void`
  `visit(QueryVisitor visitor)`

  ### Methods inherited from class org.apache.lucene.queries.spans.SpanQuery

  `getTermStates, getTermStates`

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

  `classHash, sameClassAs, toString`

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

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

- ## Field Details

  - ### payloadToMatch

    protected final List<BytesRef> payloadToMatch

  - ### match

    protected final SpanQuery match

  - ### operation

    protected final SpanPayloadCheckQuery.MatchOperation operation

  - ### payloadType

    protected final SpanPayloadCheckQuery.PayloadType payloadType

- ## Constructor Details

  - ### SpanPayloadCheckQuery

    public SpanPayloadCheckQuery(SpanQuery match, List<BytesRef> payloadToMatch)
    Parameters:
      `match` - The underlying `SpanQuery` to check
      `payloadToMatch` - The `List` of payloads to match

  - ### SpanPayloadCheckQuery

    public SpanPayloadCheckQuery(SpanQuery match, List<BytesRef> payloadToMatch, SpanPayloadCheckQuery.PayloadType payloadType, SpanPayloadCheckQuery.MatchOperation operation)
    Parameters:
      `match` - The underlying `SpanQuery` to check
      `payloadToMatch` - The `List` of payloads to match
      `payloadType` - specify if the format of the bytes in the payload (String, Integer, or Float)
      `operation` - The equality check, lt, lte, gt, gte, or eq. Defaults to eq for equals)

- ## Method Details

  - ### getField

    public String getField()
    Description copied from class: `SpanQuery`
    Returns the name of the field matched by this query.
    Specified by:
      `getField` in class `SpanQuery`

  - ### createWeight

    public SpanWeight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException
    Specified by:
      `createWeight` in class `SpanQuery`
    Throws:
      `IOException`

  - ### rewrite

    public Query rewrite(IndexSearcher indexSearcher) throws IOException
    Overrides:
      `rewrite` in class `Query`
    Throws:
      `IOException`

  - ### visit

    public void visit(QueryVisitor visitor)
    Specified by:
      `visit` in class `Query`

  - ### toString

    public String toString(String field)
    Specified by:
      `toString` in class `Query`

  - ### equals

    public boolean equals(Object other)
    Specified by:
      `equals` in class `Query`

  - ### hashCode

    public int hashCode()
    Specified by:
      `hashCode` in class `Query`