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,
List<MinimumMatch> minimumMatch) |
Modifier and Type | Method and Description |
---|---|
CompoundQuery |
clone() |
List<Query> |
getChildQueries()
Returns all the children of the query in question.
|
List<MinimumMatch> |
getMinimumMatch() |
String |
getMinimumNumberShouldMatch()
Deprecated.
|
List<Query> |
getMust() |
List<Query> |
getMustNot() |
List<Query> |
getShould() |
boolean |
isEmptyQuery() |
boolean |
removeChildQuery(Query toRemove)
Remove 'toRemove', if 'toRemove' is currently a child of this Query object.
|
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)
Deprecated.
|
clone, deepClone
public static final String TYPE
@Deprecated public String getMinimumNumberShouldMatch()
@Deprecated 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<MinimumMatch> getMinimumMatch()
public List<Query> getChildQueries()
Query
List
is provided as a copy - changes made to it do not impact the originating Query object
in any way.getChildQueries
in class Query
public boolean replaceChildQuery(Query toReplace, Query replacement)
Query
replaceChildQuery
in class Query
public boolean removeChildQuery(Query toRemove)
Query
removeChildQuery
in class Query
public boolean isEmptyQuery()
isEmptyQuery
in class Query
public CompoundQuery clone()