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

Package org.apache.lucene.search

# Class BlendedTermQuery.Builder

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

Enclosing class:
  `BlendedTermQuery`

public static class BlendedTermQuery.Builder extends Object
A Builder for `BlendedTermQuery`.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Builder()`
  Sole constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `BlendedTermQuery.Builder`
  `add(Term term)`
  Add a new `Term` to this builder, with a default boost of `1`.
  `BlendedTermQuery.Builder`
  `add(Term term, float boost)`
  Add a `Term` with the provided boost.
  `BlendedTermQuery.Builder`
  `add(Term term, float boost, TermStates context)`
  Expert: Add a `Term` with the provided boost and context.
  `BlendedTermQuery`
  `build()`
  Build the `BlendedTermQuery`.
  `BlendedTermQuery.Builder`
  `setRewriteMethod(BlendedTermQuery.RewriteMethod rewiteMethod)`
  Set the `BlendedTermQuery.RewriteMethod`.

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

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

- ## Constructor Details

  - ### Builder

    public Builder()
    Sole constructor.

- ## Method Details

  - ### setRewriteMethod

    public BlendedTermQuery.Builder setRewriteMethod(BlendedTermQuery.RewriteMethod rewiteMethod)
    Set the `BlendedTermQuery.RewriteMethod`. Default is to use `BlendedTermQuery.DISJUNCTION_MAX_REWRITE`.
    See Also:
      - `BlendedTermQuery.RewriteMethod`

  - ### add

    public BlendedTermQuery.Builder add(Term term)
    Add a new `Term` to this builder, with a default boost of `1`.
    See Also:
      - `add(Term, float)`

  - ### add

    public BlendedTermQuery.Builder add(Term term, float boost)
    Add a `Term` with the provided boost. The higher the boost, the more this term will contribute to the overall score of the `BlendedTermQuery`.

  - ### add

    public BlendedTermQuery.Builder add(Term term, float boost, TermStates context)
    Expert: Add a `Term` with the provided boost and context. This method is useful if you already have a `TermStates` object constructed for the given term.

  - ### build

    public BlendedTermQuery build()
    Build the `BlendedTermQuery`.