@SearchPrimitive public class BooleanQuery extends Object implements SearchQuery
A boolean query that allows and/or and not combinations of sub queries.
TODO: This SearchQuery implementation does not work with the QuerySerializer (or parser) since that mechanism relies on all parameters returned by getParameters having the same meaning; this is not currently true in this implementation.
Modifier and Type | Class and Description |
---|---|
static class |
BooleanQuery.Builder |
Constructor and Description |
---|
BooleanQuery(Collection<? extends SearchQuery> must,
Collection<? extends SearchQuery> should,
Collection<? extends SearchQuery> mustNot)
Construct a new BooleanQuery encapsulating the supplied sub queries.
|
BooleanQuery(Collection<? extends SearchQuery> must,
Collection<? extends SearchQuery> should,
Collection<? extends SearchQuery> mustNot,
float boost)
Construct a new BooleanQuery encapsulating the supplied sub queries.
|
BooleanQuery(Set<? extends SearchQuery> must,
Set<? extends SearchQuery> should,
Set<? extends SearchQuery> mustNot)
Deprecated.
since 5.9 use
BooleanQuery(Collection, Collection, Collection) |
Modifier and Type | Method and Description |
---|---|
static SearchQuery |
andQuery(SearchQuery... queries)
Build an AND query from one or more subqueries.
|
static BooleanQuery.Builder |
builder() |
static SearchQuery |
composeAndQuery(Set<? extends SearchQuery> subqueries)
Return a query that "ANDs" together a list of queries.
|
static SearchQuery |
composeOrQuery(Set<? extends SearchQuery> subqueries)
Return a query that "ORs" together a list of queries.
|
boolean |
equals(Object obj) |
SearchQuery |
expand()
Expands this query into a composite query (that composes other queries).
|
float |
getBoost()
Return boost factor of this query.
|
String |
getKey() |
Set<SearchQuery> |
getMustNotQueries() |
Set<SearchQuery> |
getMustQueries() |
List |
getParameters()
List of parameters as
String s or SearchQuery s. |
Set<SearchQuery> |
getShouldQueries() |
int |
hashCode() |
static SearchQuery |
orQuery(SearchQuery... queries)
Create a query that is the OR of the provided sub-queries
|
String |
toString() |
public static final String KEY
@Deprecated public BooleanQuery(Set<? extends SearchQuery> must, Set<? extends SearchQuery> should, Set<? extends SearchQuery> mustNot)
BooleanQuery(Collection, Collection, Collection)
public BooleanQuery(Collection<? extends SearchQuery> must, Collection<? extends SearchQuery> should, Collection<? extends SearchQuery> mustNot)
must
- the queries that must match.should
- the queries that may match.mustNot
- the queries that must not match.IllegalArgumentException
- if the parameters are not correct.public BooleanQuery(Collection<? extends SearchQuery> must, Collection<? extends SearchQuery> should, Collection<? extends SearchQuery> mustNot, float boost)
must
- the queries that must match.should
- the queries that may match.mustNot
- the queries that must not match.boost
- the boost factor.IllegalArgumentException
- if the parameters are not correct.public String getKey()
getKey
in interface SearchQuery
public static SearchQuery composeAndQuery(Set<? extends SearchQuery> subqueries)
AllQuery
is installed. If it contains only a single entry, then that entry is returned. Otherwise a BooleanQuery
combining the full list is returned.subqueries
- a list of SearchQuery
s to combine. Must have size >= 1.SearchQuery
combining the subqueries
.IllegalArgumentException
- if the list of subqueries is empty.public static SearchQuery andQuery(SearchQuery... queries)
queries
- the SearchQuery
s to combine. Must be >= 1.SearchQuery
combining the subqueries
.IllegalArgumentException
- if the list of subqueries is empty.public static SearchQuery composeOrQuery(Set<? extends SearchQuery> subqueries)
AllQuery
is installed. If it contains only a single entry, then that entry is returned. Otherwise a BooleanQuery
combining the full list is returned.subqueries
- a list of SearchQuery
s to combine. Must have size >= 1.SearchQuery
combining the subqueries
.IllegalArgumentException
- if the list of subqueries is empty.public static SearchQuery orQuery(SearchQuery... queries)
queries
- the queries to ORpublic Set<SearchQuery> getMustQueries()
public Set<SearchQuery> getShouldQueries()
public Set<SearchQuery> getMustNotQueries()
public SearchQuery expand()
SearchQuery
expand
in interface Expandable<SearchQuery>
expand
in interface SearchQuery
public List getParameters()
SearchQuery
String
s or SearchQuery
s.getParameters
in interface SearchQuery
public float getBoost()
SearchQuery
BooleanQuery
.getBoost
in interface SearchQuery
public static BooleanQuery.Builder builder()
Copyright © 2003–2020 Atlassian. All rights reserved.