public static class BooleanQuery.Builder
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.List<BooleanClause> |
clauses |
private int |
minimumNumberShouldMatch |
Constructor and Description |
---|
Builder()
Sole constructor.
|
Modifier and Type | Method and Description |
---|---|
BooleanQuery.Builder |
add(BooleanClause clause)
Add a new clause to this
BooleanQuery.Builder . |
BooleanQuery.Builder |
add(Query query,
BooleanClause.Occur occur)
Add a new clause to this
BooleanQuery.Builder . |
BooleanQuery |
build()
Create a new
BooleanQuery based on the parameters that have
been set on this builder. |
BooleanQuery.Builder |
setMinimumNumberShouldMatch(int min)
Specifies a minimum number of the optional BooleanClauses
which must be satisfied.
|
private int minimumNumberShouldMatch
private final java.util.List<BooleanClause> clauses
public BooleanQuery.Builder setMinimumNumberShouldMatch(int min)
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.
min
- the number of optional clauses that must matchpublic BooleanQuery.Builder add(BooleanClause clause)
BooleanQuery.Builder
. Note that the order in which
clauses are added does not have any impact on matching documents or query
performance.BooleanQuery.TooManyClauses
- if the new number of clauses exceeds the maximum clause numberpublic BooleanQuery.Builder add(Query query, BooleanClause.Occur occur)
BooleanQuery.Builder
. Note that the order in which
clauses are added does not have any impact on matching documents or query
performance.BooleanQuery.TooManyClauses
- if the new number of clauses exceeds the maximum clause numberpublic BooleanQuery build()
BooleanQuery
based on the parameters that have
been set on this builder.