Class BooleanQuery.Builder

  • Enclosing class:
    BooleanQuery

    public static class BooleanQuery.Builder
    extends Object
    A builder for boolean queries.
    • Constructor Detail

      • Builder

        public Builder()
        Sole constructor.
    • Method Detail

      • setMinimumNumberShouldMatch

        public BooleanQuery.Builder setMinimumNumberShouldMatch​(int min)
        Specifies a minimum number of the optional BooleanClauses which must be satisfied.

        By default no optional clauses are necessary for a match (unless there are no required clauses). If this method is used, then the specified number of clauses is required.

        Use of this method is totally independent of specifying that any specific clauses are required (or prohibited). This number will only be compared against the number of matching optional clauses.

        Parameters:
        min - the number of optional clauses that must match
      • build

        public BooleanQuery build()
        Create a new BooleanQuery based on the parameters that have been set on this builder.