Added must/should/mustNot method variants that accepts vararg FilterBuilder instances.
This commit is contained in:
parent
31a8e92b8e
commit
4a9faac470
|
@ -55,6 +55,36 @@ public class BoolFilterBuilder extends BaseFilterBuilder {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds multiple <i>should</i> filters.
|
||||
*/
|
||||
public BoolFilterBuilder should(FilterBuilder... filterBuilders) {
|
||||
for (FilterBuilder filterBuilder : filterBuilders) {
|
||||
clauses.add(new Clause(filterBuilder, BooleanClause.Occur.SHOULD));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds multiple <i>must</i> filters.
|
||||
*/
|
||||
public BoolFilterBuilder must(FilterBuilder... filterBuilders) {
|
||||
for (FilterBuilder filterBuilder : filterBuilders) {
|
||||
clauses.add(new Clause(filterBuilder, BooleanClause.Occur.MUST));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds multiple <i>must not</i> filters.
|
||||
*/
|
||||
public BoolFilterBuilder mustNot(FilterBuilder... filterBuilders) {
|
||||
for (FilterBuilder filterBuilder : filterBuilders) {
|
||||
clauses.add(new Clause(filterBuilder, BooleanClause.Occur.MUST_NOT));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a filter that <i>should</i> appear in the matching documents. For a boolean filter
|
||||
* with no <tt>MUST</tt> clauses one or more <code>SHOULD</code> clauses must match a document
|
||||
|
|
Loading…
Reference in New Issue