001package io.ebean.search;
002
003/**
004 * Options for the text match expression.
005 */
006public class Match extends AbstractMatch {
007
008  protected boolean phrase;
009
010  protected boolean phrasePrefix;
011
012  public Match() {
013  }
014
015  /**
016   * Set this to be a "Phrase" type expression.
017   */
018  public Match phrase() {
019    phrase = true;
020    return this;
021  }
022
023  /**
024   * Set this to be a "Phrase Prefix" type expression.
025   */
026  public Match phrasePrefix() {
027    phrasePrefix = true;
028    return this;
029  }
030
031  /**
032   * Use the AND operator (rather than OR).
033   */
034  public Match opAnd() {
035    operatorAnd = true;
036    return this;
037  }
038
039  /**
040   * Use the OR operator (rather than AND).
041   */
042  public Match opOr() {
043    operatorAnd = false;
044    return this;
045  }
046
047  /**
048   * Set the zero terms.
049   */
050  public Match zeroTerms(String zeroTerms) {
051    this.zeroTerms = zeroTerms;
052    return this;
053  }
054
055  /**
056   * Set the cutoff frequency.
057   */
058  public Match cutoffFrequency(double cutoffFrequency) {
059    this.cutoffFrequency = cutoffFrequency;
060    return this;
061  }
062
063  /**
064   * Set the max expansions (for phrase prefix only).
065   */
066  public Match maxExpansions(int maxExpansions) {
067    this.maxExpansions = maxExpansions;
068    return this;
069  }
070
071  /**
072   * Set the Analyzer to use for this expression.
073   */
074  public Match analyzer(String analyzer) {
075    this.analyzer = analyzer;
076    return this;
077  }
078
079  /**
080   * Set the boost.
081   */
082  public Match boost(double boost) {
083    this.boost = boost;
084    return this;
085  }
086
087  /**
088   * Set the rewrite to use.
089   */
090  public Match minShouldMatch(String minShouldMatch) {
091    this.minShouldMatch = minShouldMatch;
092    return this;
093  }
094
095  /**
096   * Set the rewrite to use.
097   */
098  public Match rewrite(String rewrite) {
099    this.rewrite = rewrite;
100    return this;
101  }
102
103  /**
104   * Return true if this is a phrase query.
105   */
106  public boolean isPhrase() {
107    return phrase;
108  }
109
110  /**
111   * Return true if this is a phrase prefix query.
112   */
113  public boolean isPhrasePrefix() {
114    return phrasePrefix;
115  }
116
117}