public class

BooleanQuery

extends Object
implements SearchQuery
java.lang.Object
   ↳ com.atlassian.confluence.search.v2.query.BooleanQuery

Class Overview

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.

Summary

Public Constructors
BooleanQuery(Set<? extends SearchQuery> must, Set<? extends SearchQuery> should, Set<? extends SearchQuery> mustNot)
Construct a new BooleanQuery encapsulating the supplied sub queries.
Public Methods
static SearchQuery composeAndQuery(SearchQuery searchQueryOne, SearchQuery searchQueryTwo)
Build an AND query from exactly two sub-queries.
static SearchQuery composeAndQuery(Set<? extends SearchQuery> subqueries)
Return a query that "ANDs" together a list of queries.
static SearchQuery composeOrQuery(SearchQuery searchQueryOne, SearchQuery searchQueryTwo)
Create a query that is the OR of the two provided sub-queries
static SearchQuery composeOrQuery(Set<? extends SearchQuery> subqueries)
Return a query that "ORs" together a list of queries.
boolean equals(Object obj)
String getKey()
Set<SearchQuery> getMustNotQueries()
Set<SearchQuery> getMustQueries()
List getParameters()
List of parameters as Strings or SearchQuerys.
Set<SearchQuery> getShouldQueries()
int hashCode()
String toString()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.confluence.search.v2.SearchQuery

Public Constructors

public BooleanQuery (Set<? extends SearchQuery> must, Set<? extends SearchQuery> should, Set<? extends SearchQuery> mustNot)

Construct a new BooleanQuery encapsulating the supplied sub queries. Either of the andQueries or the orQueries may be null but not both. You cannot have any notQueries without having at least one andQuery or orQuery.

Parameters
must the queries that must match.
should the queries that may match.
mustNot the queries that must not match.
Throws
IllegalArgumentException if the parameters are not correct.

Public Methods

public static SearchQuery composeAndQuery (SearchQuery searchQueryOne, SearchQuery searchQueryTwo)

Build an AND query from exactly two sub-queries.

Parameters
searchQueryOne the first sub-query
searchQueryTwo the second sub-query
Returns
  • the logical AND of the two provided queries

public static SearchQuery composeAndQuery (Set<? extends SearchQuery> subqueries)

Return a query that "ANDs" together a list of queries. If the list contains no entries then an AllQuery is installed. If it contains only a single entry, then that entry is returned. Otherwise a BooleanQuery combining the full list is returned.

Parameters
subqueries a list of SearchQuerys to combine. Must have size >= 1.
Returns
Throws
IllegalArgumentException if the list of subqueries is empty.

public static SearchQuery composeOrQuery (SearchQuery searchQueryOne, SearchQuery searchQueryTwo)

Create a query that is the OR of the two provided sub-queries

Parameters
searchQueryOne the first query to OR
searchQueryTwo the second query to OR
Returns
  • the OR of the two provided queries

public static SearchQuery composeOrQuery (Set<? extends SearchQuery> subqueries)

Return a query that "ORs" together a list of queries. If the list contains no entries then an AllQuery is installed. If it contains only a single entry, then that entry is returned. Otherwise a BooleanQuery combining the full list is returned.

Parameters
subqueries a list of SearchQuerys to combine. Must have size >= 1.
Returns
Throws
IllegalArgumentException if the list of subqueries is empty.

public boolean equals (Object obj)

public String getKey ()

public Set<SearchQuery> getMustNotQueries ()

public Set<SearchQuery> getMustQueries ()

public List getParameters ()

List of parameters as Strings or SearchQuerys.

Returns
  • a List containing all the sub queries combined together. I'm not sure this is ever useful to anyone.

public Set<SearchQuery> getShouldQueries ()

public int hashCode ()

public String toString ()