Package org.apache.lucene.sandbox.search

## Class PhraseWildcardQuery.Builder

- java.lang.Object
- - org.apache.lucene.sandbox.search.PhraseWildcardQuery.Builder

- Enclosing class:
    PhraseWildcardQuery

      public static class PhraseWildcardQuery.Builder
      extends Object

  Builds a `PhraseWildcardQuery`.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected String` | `field` |
    `protected int` | `maxMultiTermExpansions` |
    `protected List<PhraseWildcardQuery.PhraseTerm>` | `phraseTerms` |
    `protected boolean` | `segmentOptimizationEnabled` |
    `protected int` | `slop` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Builder​(String field, int maxMultiTermExpansions)` |
    `Builder​(String field, int maxMultiTermExpansions, boolean segmentOptimizationEnabled)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `PhraseWildcardQuery.Builder` | `addMultiTerm​(MultiTermQuery multiTermQuery)` | Adds a multi-term at the next position in the phrase.
    `PhraseWildcardQuery.Builder` | `addTerm​(Term term)` | Adds a single term at the next position in the phrase.
    `PhraseWildcardQuery.Builder` | `addTerm​(BytesRef termBytes)` | Adds a single term at the next position in the phrase.
    `PhraseWildcardQuery` | `build()` | Builds a `PhraseWildcardQuery`.
    `PhraseWildcardQuery.Builder` | `setSlop​(int slop)` | Sets the phrase slop.

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

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

- - ### Field Detail

    - #### field

          protected final String field

    - #### phraseTerms

          protected final List<PhraseWildcardQuery.PhraseTerm> phraseTerms

    - #### slop

          protected int slop

    - #### maxMultiTermExpansions

          protected final int maxMultiTermExpansions

    - #### segmentOptimizationEnabled

          protected final boolean segmentOptimizationEnabled

  - ### Constructor Detail

    - #### Builder

          public Builder​(String field,
                         int maxMultiTermExpansions)

      Parameters:
        `field` - The query field.
        `maxMultiTermExpansions` - The maximum number of expansions across all multi-terms and across all segments. It counts expansions for each segments individually, that allows optimizations per segment and unused expansions are credited to next segments. This is different from `MultiPhraseQuery` and `SpanMultiTermQueryWrapper` which have an expansion limit per multi-term.

    - #### Builder

          public Builder​(String field,
                         int maxMultiTermExpansions,
                         boolean segmentOptimizationEnabled)

      Parameters:
        `field` - The query field.
        `maxMultiTermExpansions` - The maximum number of expansions across all multi-terms and across all segments. It counts expansions for each segments individually, that allows optimizations per segment and unused expansions are credited to next segments. This is different from `MultiPhraseQuery` and `SpanMultiTermQueryWrapper` which have an expansion limit per multi-term.
        `segmentOptimizationEnabled` - Whether to enable the segment optimization which consists in ignoring a segment for further analysis as soon as a term is not present inside it. This optimizes the query execution performance but changes the scoring. The result ranking is preserved.

  - ### Method Detail

    - #### addTerm

          public PhraseWildcardQuery.Builder addTerm​(BytesRef termBytes)

      Adds a single term at the next position in the phrase.

    - #### addTerm

          public PhraseWildcardQuery.Builder addTerm​(Term term)

      Adds a single term at the next position in the phrase.

    - #### addMultiTerm

          public PhraseWildcardQuery.Builder addMultiTerm​(MultiTermQuery multiTermQuery)

      Adds a multi-term at the next position in the phrase. Any of the terms returned by the provided `MultiTermQuery` enumeration may match (expansion as a disjunction).

    - #### setSlop

          public PhraseWildcardQuery.Builder setSlop​(int slop)

      Sets the phrase slop.

    - #### build

          public PhraseWildcardQuery build()

      Builds a `PhraseWildcardQuery`.