public class CompoundQuery extends Query
CompoundQuery wraps an arbitrary number of subqueries. Each clause is specified as a "must", "mustNot", or
"should" - indicating how the subquery result set impacts the result set of the compound whole.| Modifier and Type | Class and Description |
|---|---|
static class |
CompoundQuery.Operator |
| Constructor and Description |
|---|
CompoundQuery(String minimumNumberShouldMatch,
List<Query> must,
List<Query> should,
List<Query> mustNot) |
| Modifier and Type | Method and Description |
|---|---|
CompoundQuery |
clone() |
List<Query> |
getChildQueries()
Returns all the children of the query in question.
|
String |
getMinimumNumberShouldMatch() |
List<Query> |
getMust() |
List<Query> |
getMustNot() |
List<Query> |
getShould() |
boolean |
removeChildQuery(Query toRemove) |
boolean |
replaceChildQuery(Query toReplace,
Query replacement)
Swap 'replacement' in as a replacement, if 'toReplace' is currently a child of this Query object.
|
void |
setMinimumNumberShouldMatch(String minimumNumberShouldMatch) |
clone, deepClonepublic static final String TYPE
public String getMinimumNumberShouldMatch()
public void setMinimumNumberShouldMatch(String minimumNumberShouldMatch)
public List<Query> getMust()
public List<Query> getShould()
When "must" clauses are present, "should" clauses primarily affect scoring (and as a result, default sorting). When "must" clauses are absent but "should" clauses are present, documents must match at least one "should" clause to be included in the overall result set.
public List<Query> getMustNot()
If a CompoundQuery contains only "mustNot" queries, the overall results are computed as if a "must"
MatchAllQuery was specified.
public List<Query> getChildQueries()
QueryList is provided as a copy - changes made to it do not impact the originating Query object
in any way.getChildQueries in class Querypublic boolean replaceChildQuery(Query toReplace, Query replacement)
QueryreplaceChildQuery in class Querypublic CompoundQuery clone()
public boolean removeChildQuery(Query toRemove)