public interface Query
this.
See http://www.infoq.com/articles/internal-dsls-java for a description of these conventions.
A query can be executed and then modified and re-executed. If end() is called the query is made immutable.
Both Element keys and attributes of Element can be queried. Attributes must be pre-defined for a cache. They are populated by extraction
from an Element's value using an AttributeExtractor .
Search results can either be Element keys (the default), values, or the result of an Aggregator function.
A Query instance can be used by multiple threads| Modifier and Type | Field and Description |
|---|---|
static Attribute |
KEY
The search attribute for a cache element's key.
|
static Attribute |
VALUE
The search attribute for a cache element's value.
|
| Modifier and Type | Method and Description |
|---|---|
Query |
addCriteria(Criteria criteria)
Adds a criteria to the query
|
Query |
addGroupBy(Attribute<?>... attribute)
Group result set by unique value(s) of specified attribute(s).
|
Query |
addOrderBy(Attribute<?> attribute,
Direction direction)
Request result set ordering by the given attribute and direction.
|
Query |
end()
Optional method for terminating query creation.
|
Results |
execute()
Execute this query.
|
Query |
includeAggregator(Aggregator... aggregators)
Request this query to aggregate the results by the given Aggregator(s)
This method may be called multiple times to request multiple aggregations
|
Query |
includeAttribute(Attribute<?>... attributes)
Request that the given attribute(s) should be present in the result for
this query.
|
Query |
includeKeys()
Request that the key object be present in the results.
|
Query |
includeValues()
Request that the value object be present in the results.
|
Query |
maxResults(int maxResults)
Restrict the number of results returned from the search.
|
static final Attribute KEY
AttributeTypestatic final Attribute VALUE
AttributeTypeQuery includeKeys()
Query includeValues()
Query includeAttribute(Attribute<?>... attributes)
maxResults(int) or by using Results.range(int, int) rathern than Results.all()attributes - the query attributes to selectQuery includeAggregator(Aggregator... aggregators) throws SearchException, AggregatorException
aggregators - SearchExceptionAggregatorExceptionQuery addOrderBy(Attribute<?> attribute, Direction direction)
attribute - The attribute to order the results bydirection - Ascending or descendingQuery addGroupBy(Attribute<?>... attribute)
attribute - Query maxResults(int maxResults)
maxResults clause to your query to limit the size.maxResults - the maximum number of results to returnResults execute() throws SearchException
TimeoutBehaviorConfiguration.TimeoutBehaviorType.NOOP and
TimeoutBehaviorConfiguration.TimeoutBehaviorType.LOCAL_READS behaviorSearchExceptionQuery end()
Copyright © 2003-2014 Terracotta, Inc.. All Rights Reserved.