Package com.atlassian.crowd.search.util
Class QuerySplitter
java.lang.Object
com.atlassian.crowd.search.util.QuerySplitter
Utility class for executing split queries and merging results.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceQuerySplitter.EntitySearcher<T,E extends Exception> static interfaceQuerySplitter.MembershipSearcher<T,E extends Exception> static interface -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbatchConditionsIfNeeded(EntityQuery<T> query, QuerySplitter.EntitySearcher<T, E> searcher, int maxRestrictionsPerQuery) Splits the query if needed, executes it, aggregates and returns results.batchNamesToMatchIfNeeded(MembershipQuery<T> query, QuerySplitter.MembershipSearcher<T, E> searcher, int maxBatchSize) Splits the query if needed, executes it, aggregates and returns 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 ESplits the query if needed, executes it, aggregates and returns results. Query is split if the number of OR conditions is higher thanmaxRestrictionsPerQuery. Only top level condition split is supported.- Type Parameters:
T- result type- Parameters:
query- original query to be executedsearcher- query results providermaxRestrictionsPerQuery- maximum number of restrictions allowed in the single query- Returns:
- results of the original
query - Throws:
OperationFailedException- rethrows exception fromsearcherE extends Exception
-
batchNamesToMatchIfNeeded
public static <T,E extends Exception> List<T> batchNamesToMatchIfNeeded(MembershipQuery<T> query, QuerySplitter.MembershipSearcher<T, E> searcher, int maxBatchSize) throws ESplits the query if needed, executes it, aggregates and returns results. Query is split if the size ofMembershipQuery.getEntityNamesToMatch()is higher thanmaxBatchSize.- Type Parameters:
T- result type- Parameters:
query- original query to be executedsearcher- query results providermaxBatchSize- maximum number ofMembershipQuery.getEntityNamesToMatch()allowed in the single query- Returns:
- results of the original
query - Throws:
OperationFailedException- rethrows exception fromsearcherE extends Exception
-