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

Package org.apache.lucene.queries.spans

# Class SpanNearQuery.Builder

java.lang.Object
org.apache.lucene.queries.spans.SpanNearQuery.Builder

Enclosing class:
  `SpanNearQuery`

public static class SpanNearQuery.Builder extends Object
A builder for SpanNearQueries

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Builder(String field, boolean ordered)`
  Construct a new builder

- ## Method Summary

  Modifier and Type
  Method
  Description
  `SpanNearQuery.Builder`
  `addClause(SpanQuery clause)`
  Add a new clause
  `SpanNearQuery.Builder`
  `addGap(int width)`
  Add a gap after the previous clause of a defined width
  `SpanNearQuery`
  `build()`
  Build the query
  `SpanNearQuery.Builder`
  `setSlop(int slop)`
  Set the slop for this query

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

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

- ## Constructor Details

  - ### Builder

    public Builder(String field, boolean ordered)
    Construct a new builder
    Parameters:
      `field` - the field to search in
      `ordered` - whether or not clauses must be in-order to match

- ## Method Details

  - ### addClause

    public SpanNearQuery.Builder addClause(SpanQuery clause)
    Add a new clause

  - ### addGap

    public SpanNearQuery.Builder addGap(int width)
    Add a gap after the previous clause of a defined width

  - ### setSlop

    public SpanNearQuery.Builder setSlop(int slop)
    Set the slop for this query

  - ### build

    public SpanNearQuery build()
    Build the query