Package org.apache.unomi.api.services
Interface QueryService
-
- All Known Implementing Classes:
QueryServiceImpl
public interface QueryService
A service to perform queries.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description Map<String,Long>
getAggregate(String itemType, String property)
Retrieves the number of items with the specified type as defined by the Item subclass public fieldITEM_TYPE
and aggregated by possible values of the specified property.Map<String,Long>
getAggregate(String itemType, String property, AggregateQuery query)
Deprecated.As of 1.3.0-incubating, please usegetAggregateWithOptimizedQuery(String, String, AggregateQuery)
insteadMap<String,Long>
getAggregateWithOptimizedQuery(String itemType, String property, AggregateQuery query)
Retrieves the number of items with the specified type as defined by the Item subclass public fieldITEM_TYPE
and aggregated by possible values of the specified property or, if the specified query is notnull
, perform that aggregate query.Map<String,Double>
getMetric(String type, String property, String slashConcatenatedMetrics, Condition condition)
Retrieves the specified metrics for the specified field of items of the specified type as defined by the Item subclass public fieldITEM_TYPE
and matching the specifiedCondition
.long
getQueryCount(String itemType, Condition condition)
Retrieves the number of items of the specified type as defined by the Item subclass public fieldITEM_TYPE
and matching the specifiedCondition
.
-
-
-
Method Detail
-
getAggregate
Map<String,Long> getAggregate(String itemType, String property)
Retrieves the number of items with the specified type as defined by the Item subclass public fieldITEM_TYPE
and aggregated by possible values of the specified property.- Parameters:
itemType
- the String representation of the item type we want to retrieve the count of, as defined by its class'ITEM_TYPE
fieldproperty
- the property we're aggregating on, i.e. for each possible value of this property, we are counting how many items of the specified type have that value- Returns:
- a Map associating a specific value of the property to the cardinality of items with that value
- See Also:
Item for a discussion of
-
getAggregate
@Deprecated Map<String,Long> getAggregate(String itemType, String property, AggregateQuery query)
Deprecated.As of 1.3.0-incubating, please usegetAggregateWithOptimizedQuery(String, String, AggregateQuery)
insteadTODO: rework, this method is confusing since it either behaves likegetAggregate(String, String)
if query is null but completely differently if it isn't Retrieves the number of items with the specified type as defined by the Item subclass public fieldITEM_TYPE
and aggregated by possible values of the specified property or, if the specified query is notnull
, perform that aggregate query. Also return the global count of document matching theITEM_TYPE
- Parameters:
itemType
- the String representation of the item type we want to retrieve the count of, as defined by its class'ITEM_TYPE
fieldproperty
- the property we're aggregating on, i.e. for each possible value of this property, we are counting how many items of the specified type have that valuequery
- theAggregateQuery
specifying the aggregation that should be perfomed- Returns:
- a Map associating a specific value of the property to the cardinality of items with that value
- See Also:
Item for a discussion of
-
getAggregateWithOptimizedQuery
Map<String,Long> getAggregateWithOptimizedQuery(String itemType, String property, AggregateQuery query)
Retrieves the number of items with the specified type as defined by the Item subclass public fieldITEM_TYPE
and aggregated by possible values of the specified property or, if the specified query is notnull
, perform that aggregate query. This aggregate won't return the global count and should therefore be much faster thangetAggregate(String, String, AggregateQuery)
- Parameters:
itemType
- the String representation of the item type we want to retrieve the count of, as defined by its class'ITEM_TYPE
fieldproperty
- the property we're aggregating on, i.e. for each possible value of this property, we are counting how many items of the specified type have that valuequery
- theAggregateQuery
specifying the aggregation that should be perfomed- Returns:
- a Map associating a specific value of the property to the cardinality of items with that value
- See Also:
Item for a discussion of
-
getQueryCount
long getQueryCount(String itemType, Condition condition)
Retrieves the number of items of the specified type as defined by the Item subclass public fieldITEM_TYPE
and matching the specifiedCondition
.- Parameters:
condition
- the condition the items must satisfyitemType
- the String representation of the item type we want to retrieve the count of, as defined by its class'ITEM_TYPE
field- Returns:
- the number of items of the specified type
- See Also:
Item for a discussion of
-
getMetric
Map<String,Double> getMetric(String type, String property, String slashConcatenatedMetrics, Condition condition)
Retrieves the specified metrics for the specified field of items of the specified type as defined by the Item subclass public fieldITEM_TYPE
and matching the specifiedCondition
.- Parameters:
condition
- the condition the items must satisfyslashConcatenatedMetrics
- a String specifying which metrics should be computed, separated by a slash (/
) (possible values:sum
for the sum of the values,avg
for the average of the values,min
for the minimum value andmax
for the maximum value)property
- the name of the field for which the metrics should be computedtype
- the String representation of the item type we want to retrieve the count of, as defined by its class'ITEM_TYPE
field- Returns:
- a Map associating computed metric name as key to its associated value
- See Also:
Item for a discussion of
-
-