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 and Description
    `Builder(String field)` Sole constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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` | `build()` Builds the `SynonymQuery`.

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

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

- - ### Constructor Detail

    - #### Builder

          public Builder(String field)

      Sole constructor
      Parameters:
        `field` - The target field name

  - ### Method Detail

    - #### 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`.

    - #### build

          public SynonymQuery build()

      Builds the `SynonymQuery`.

Copyright © 2000-2022 Apache Software Foundation. All Rights Reserved.