SynonymQuery.Builder (Lucene 10.5.0 core API)
Description: declaration: package: org.apache.lucene.search, class: SynonymQuery, class: Builder

Package org.apache.lucene.search

# Class SynonymQuery.Builder

java.lang.Object
org.apache.lucene.search.SynonymQuery.Builder

Enclosing class:
  `SynonymQuery`

public static class SynonymQuery.Builder extends Object
A builder for `SynonymQuery`.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Builder(String field)`
  Sole constructor

- ## Method Summary

  Modifier and Type
  Method
  Description
  `SynonymQuery.Builder`
  `addTerm(Term term)`
  Adds the provided `term` as a synonym.
  `SynonymQuery.Builder`
  `addTerm(Term term, float boost)`
  Adds the provided `term` as a synonym, document frequencies of this term will be boosted by `boost`.
  `SynonymQuery.Builder`
  `addTerm(BytesRef term, float boost)`
  Adds the provided `term` as a synonym, document frequencies of this term will be boosted by `boost`.
  `SynonymQuery`
  `build()`
  Builds the `SynonymQuery`.

  ### 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)
    Sole constructor
    Parameters:
      `field` - The target field name

- ## Method Details

  - ### addTerm

    public SynonymQuery.Builder addTerm(Term term)
    Adds the provided `term` as a synonym.

  - ### addTerm

    public SynonymQuery.Builder addTerm(Term term, float boost)
    Adds the provided `term` as a synonym, document frequencies of this term will be boosted by `boost`.

  - ### addTerm

    public SynonymQuery.Builder addTerm(BytesRef term, float boost)
    Adds the provided `term` as a synonym, document frequencies of this term will be boosted by `boost`.

  - ### build

    public SynonymQuery build()
    Builds the `SynonymQuery`.