Package com.google.gerrit.index.query
Class InternalQuery<T>
- java.lang.Object
-
- com.google.gerrit.index.query.InternalQuery<T>
-
- Direct Known Subclasses:
InternalAccountQuery
,InternalChangeQuery
,InternalGroupQuery
public class InternalQuery<T> extends Object
Execute a single query over a secondary index, for use by Gerrit internals.By default, visibility of returned entities is not enforced (unlike in
QueryProcessor
). The methods in this class are not typically used by user-facing paths, but rather by internal callers that need to process all matching results.Instances are one-time-use. Other singleton classes should inject a Provider rather than holding on to a single instance.
-
-
Field Summary
Fields Modifier and Type Field Description protected IndexConfig
indexConfig
-
Constructor Summary
Constructors Modifier Constructor Description protected
InternalQuery(QueryProcessor<T> queryProcessor, IndexCollection<?,T,? extends Index<?,T>> indexes, IndexConfig indexConfig)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InternalQuery<T>
enforceVisibility(boolean enforce)
InternalQuery<T>
noFields()
List<T>
query(Predicate<T> p)
List<List<T>>
query(List<Predicate<T>> queries)
Run multiple queries in parallel.protected Schema<T>
schema()
InternalQuery<T>
setLimit(int n)
InternalQuery<T>
setRequestedFields(FieldDef<T,?>... fields)
-
-
-
Field Detail
-
indexConfig
protected final IndexConfig indexConfig
-
-
Constructor Detail
-
InternalQuery
protected InternalQuery(QueryProcessor<T> queryProcessor, IndexCollection<?,T,? extends Index<?,T>> indexes, IndexConfig indexConfig)
-
-
Method Detail
-
setLimit
public InternalQuery<T> setLimit(int n)
-
enforceVisibility
public InternalQuery<T> enforceVisibility(boolean enforce)
-
setRequestedFields
public InternalQuery<T> setRequestedFields(FieldDef<T,?>... fields)
-
noFields
public InternalQuery<T> noFields()
-
query
public List<T> query(Predicate<T> p) throws com.google.gwtorm.server.OrmException
- Throws:
com.google.gwtorm.server.OrmException
-
query
public List<List<T>> query(List<Predicate<T>> queries) throws com.google.gwtorm.server.OrmException
Run multiple queries in parallel.If a limit was specified using
setLimit(int)
, that limit is applied to each query independently.- Parameters:
queries
- list of queries.- Returns:
- results of the queries, one list of results per input query, in the same order as the input.
- Throws:
com.google.gwtorm.server.OrmException
-
-