Class SearchQueryUtils
- java.lang.Object
-
- com.atlassian.confluence.internal.search.v2.query.SearchQueryUtils
-
@Internal public class SearchQueryUtils extends Object
Helper class to assist with any operations that require traversing the tree ofSearchQuery
s.- Since:
- 8.0
-
-
Constructor Summary
Constructors Constructor Description SearchQueryUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.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
-
-
-
Method Detail
-
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
-
-