Class SearchQueryUtils
java.lang.Object
com.atlassian.confluence.search.v2.query.SearchQueryUtils
Helper class to assist with any operations that require traversing the tree of
SearchQuery
s.- Since:
- 8.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic SearchQuery
appendIfQueryNotPresent
(@Nullable SearchQuery searchQuery, SearchQuery searchQueryToCheck, SearchQuery searchQueryToAppend) Append a search query as a top level AND query, if thesearchQueryToCheck
does not exist in the current search query tree.static <T extends SearchQuery>
booleancontainsQuery
(SearchQuery searchQuery, Class<T> searchQueryClass) Traverses the provided search query tree and checks whether it contains any queries of the specified class
-
Constructor Details
-
SearchQueryUtils
public SearchQueryUtils()
-
-
Method Details
-
appendIfQueryNotPresent
public static SearchQuery appendIfQueryNotPresent(@Nullable SearchQuery searchQuery, SearchQuery searchQueryToCheck, SearchQuery searchQueryToAppend) Append a search query as a top level AND query, if thesearchQueryToCheck
does not exist in the current search query tree.- Parameters:
searchQuery
- the search query to appendsearchQueryToAppend
to, and whose tree will be inspected.searchQueryToCheck
- the search query to check against in the search query tree.searchQueryToAppend
- the search query to append as a top level AND query, and to be checked against thesearchQuery
tree.- Returns:
- a search query appended with
searchQueryToAppend
iff the search query was not present in the trees, otherwise the originalsearchQuery
.
-
containsQuery
public static <T extends SearchQuery> boolean containsQuery(SearchQuery searchQuery, Class<T> searchQueryClass) Traverses the provided search query tree and checks whether it contains any queries of the specified class- Parameters:
searchQuery
- searchQuery treesearchQueryClass
- the SearchQuery class to search for- Returns:
- true iff a searchQuery appears anywhere in the searchQuery tree, false otherwise
-