Class QueryServiceImpl
java.lang.Object
org.apache.unomi.services.impl.queries.QueryServiceImpl
- All Implemented Interfaces:
QueryService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAggregate(String itemType, String property) Retrieves the number of items with the specified type as defined by the Item subclass public fieldITEM_TYPEand aggregated by possible values of the specified property.getAggregate(String itemType, String property, AggregateQuery query) Deprecated.getAggregateWithOptimizedQuery(String itemType, String property, AggregateQuery query) Retrieves the number of items with the specified type as defined by the Item subclass public fieldITEM_TYPEand aggregated by possible values of the specified property or, if the specified query is notnull, perform that aggregate query.Retrieves the specified metrics for the specified field of items of the specified type as defined by the Item subclass public fieldITEM_TYPEand matching the specifiedCondition.longgetQueryCount(String itemType, Condition condition) Retrieves the number of items of the specified type as defined by the Item subclass public fieldITEM_TYPEand matching the specifiedCondition.voidvoidvoidsetDefinitionsService(DefinitionsService definitionsService) voidsetPersistenceService(PersistenceService persistenceService)
-
Constructor Details
-
QueryServiceImpl
public QueryServiceImpl()
-
-
Method Details
-
setPersistenceService
-
setDefinitionsService
-
postConstruct
public void postConstruct() -
preDestroy
public void preDestroy() -
getAggregate
Description copied from interface:QueryServiceRetrieves the number of items with the specified type as defined by the Item subclass public fieldITEM_TYPEand aggregated by possible values of the specified property.- Specified by:
getAggregatein interfaceQueryService- Parameters:
itemType- the String representation of the item type we want to retrieve the count of, as defined by its class'ITEM_TYPEfieldproperty- 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:
-
getAggregate
@Deprecated public Map<String,Long> getAggregate(String itemType, String property, AggregateQuery query) Deprecated.As of version 1.3.0-incubating, usegetAggregateWithOptimizedQuery(String, String, AggregateQuery)insteadDescription copied from interface:QueryServiceTODO: rework, this method is confusing since it either behaves likeQueryService.getAggregate(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_TYPEand 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- Specified by:
getAggregatein interfaceQueryService- Parameters:
itemType- the String representation of the item type we want to retrieve the count of, as defined by its class'ITEM_TYPEfieldproperty- 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- theAggregateQueryspecifying 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:
-
getAggregateWithOptimizedQuery
public Map<String,Long> getAggregateWithOptimizedQuery(String itemType, String property, AggregateQuery query) Description copied from interface:QueryServiceRetrieves the number of items with the specified type as defined by the Item subclass public fieldITEM_TYPEand 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 thanQueryService.getAggregate(String, String, AggregateQuery)- Specified by:
getAggregateWithOptimizedQueryin interfaceQueryService- Parameters:
itemType- the String representation of the item type we want to retrieve the count of, as defined by its class'ITEM_TYPEfieldproperty- 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- theAggregateQueryspecifying 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:
-
getMetric
public Map<String,Double> getMetric(String type, String property, String slashConcatenatedMetrics, Condition condition) Description copied from interface:QueryServiceRetrieves the specified metrics for the specified field of items of the specified type as defined by the Item subclass public fieldITEM_TYPEand matching the specifiedCondition.- Specified by:
getMetricin interfaceQueryService- Parameters:
type- the String representation of the item type we want to retrieve the count of, as defined by its class'ITEM_TYPEfieldproperty- the name of the field for which the metrics should be computedslashConcatenatedMetrics- a String specifying which metrics should be computed, separated by a slash (/) (possible values:sumfor the sum of the values,avgfor the average of the values,minfor the minimum value andmaxfor the maximum value)condition- the condition the items must satisfy- Returns:
- a Map associating computed metric name as key to its associated value
- See Also:
-
getQueryCount
Description copied from interface:QueryServiceRetrieves the number of items of the specified type as defined by the Item subclass public fieldITEM_TYPEand matching the specifiedCondition.- Specified by:
getQueryCountin interfaceQueryService- Parameters:
itemType- the String representation of the item type we want to retrieve the count of, as defined by its class'ITEM_TYPEfieldcondition- the condition the items must satisfy- Returns:
- the number of items of the specified type
- See Also:
-
getAggregateWithOptimizedQuery(String, String, AggregateQuery)instead