Class SearchQueryUtils

java.lang.Object
com.atlassian.confluence.search.v2.query.SearchQueryUtils

public class SearchQueryUtils extends Object
Helper class to assist with any operations that require traversing the tree of SearchQuerys.
Since:
8.0
  • 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 the searchQueryToCheck does not exist in the current search query tree.
      Parameters:
      searchQuery - the search query to append searchQueryToAppend 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 the searchQuery tree.
      Returns:
      a search query appended with searchQueryToAppend iff the search query was not present in the trees, otherwise the original searchQuery.
    • 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 tree
      searchQueryClass - the SearchQuery class to search for
      Returns:
      true iff a searchQuery appears anywhere in the searchQuery tree, false otherwise