Class QuerySplitter

java.lang.Object
com.atlassian.crowd.search.util.QuerySplitter

public class QuerySplitter extends Object
Utility class for executing split queries and merging results.
  • Constructor Details

    • QuerySplitter

      public QuerySplitter()
  • Method Details

    • batchConditionsIfNeeded

      public static <T, E extends Exception> List<T> batchConditionsIfNeeded(EntityQuery<T> query, QuerySplitter.EntitySearcher<T,E> searcher, int maxRestrictionsPerQuery) throws E
      Splits the query if needed, executes it, aggregates and returns results. Query is split if the number of OR conditions is higher than maxRestrictionsPerQuery. Only top level condition split is supported.
      Type Parameters:
      T - result type
      Parameters:
      query - original query to be executed
      searcher - query results provider
      maxRestrictionsPerQuery - maximum number of restrictions allowed in the single query
      Returns:
      results of the original query
      Throws:
      OperationFailedException - rethrows exception from searcher
      E extends Exception
    • batchNamesToMatchIfNeeded

      public static <T, E extends Exception> List<T> batchNamesToMatchIfNeeded(MembershipQuery<T> query, QuerySplitter.MembershipSearcher<T,E> searcher, int maxBatchSize) throws E
      Splits the query if needed, executes it, aggregates and returns results. Query is split if the size of MembershipQuery.getEntityNamesToMatch() is higher than maxBatchSize.
      Type Parameters:
      T - result type
      Parameters:
      query - original query to be executed
      searcher - query results provider
      maxBatchSize - maximum number of MembershipQuery.getEntityNamesToMatch() allowed in the single query
      Returns:
      results of the original query
      Throws:
      OperationFailedException - rethrows exception from searcher
      E extends Exception