@Produces(value="application/json") @Consumes(value="application/json") @Path(value="/query") public class QueryServiceEndPoint extends Object
Constructor and Description |
---|
QueryServiceEndPoint() |
Modifier and Type | Method and Description |
---|---|
Map<String,Long> |
getAggregate(String type,
String property)
Retrieves the number of items with the specified type as defined by the Item subclass public field
ITEM_TYPE and aggregated by possible values of the specified
property. |
Map<String,Long> |
getAggregate(String type,
String property,
boolean optimizedQuery,
AggregateQuery aggregateQuery)
TODO: rework, this method is confusing since it either behaves like
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 field ITEM_TYPE and aggregated by possible values of the specified
property or, if the specified query is not null , perform that aggregate query. |
Map<String,Double> |
getMetric(String type,
String property,
String metricsType,
Condition condition)
Retrieves the specified metrics for the specified field of items of the specified type as defined by the Item subclass public field
ITEM_TYPE and matching the
specified Condition . |
long |
getQueryCount(String type,
Boolean validate,
Condition condition,
javax.servlet.http.HttpServletResponse response)
Retrieves the number of items of the specified type as defined by the Item subclass public field
ITEM_TYPE and matching the specified Condition . |
void |
setLocalizationHelper(LocalizationHelper localizationHelper) |
void |
setQueryService(QueryService queryService) |
public void setQueryService(QueryService queryService)
public void setLocalizationHelper(LocalizationHelper localizationHelper)
@GET @Path(value="/{type}/{property}") public Map<String,Long> getAggregate(@PathParam(value="type") String type, @PathParam(value="property") String property)
ITEM_TYPE
and aggregated by possible values of the specified
property.type
- 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 valueItem for a discussion of {@code ITEM_TYPE}
@POST @Path(value="/{type}/{property}") public Map<String,Long> getAggregate(@PathParam(value="type") String type, @PathParam(value="property") String property, @QueryParam(value="optimizedQuery") boolean optimizedQuery, AggregateQuery aggregateQuery)
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 field ITEM_TYPE
and aggregated by possible values of the specified
property or, if the specified query is not null
, perform that aggregate query.
Also return the global count of document matching the ITEM_TYPE
if you don't use optimizedQuery
or set it to false,
otherwise if optimizedQuery
is set to true then it won't return the global count but the query will be executed much faster.type
- 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 valueaggregateQuery
- the AggregateQuery
specifying the aggregation that should be performedoptimizedQuery
- the optimizedQuery
specifying if we should optimized the aggregate query or notItem for a discussion of {@code ITEM_TYPE}
@POST @Path(value="/{type}/{property}/{metricTypes:((sum|avg|min|max)/?)*}") public Map<String,Double> getMetric(@PathParam(value="type") String type, @PathParam(value="property") String property, @PathParam(value="metricTypes") String metricsType, Condition condition)
ITEM_TYPE
and matching the
specified Condition
.condition
- the condition the items must satisfymetricsType
- 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 and max
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
fieldItem for a discussion of {@code ITEM_TYPE}
@POST @Path(value="/{type}/count") public long getQueryCount(@PathParam(value="type") String type, @QueryParam(value="validate") Boolean validate, Condition condition, @Context javax.servlet.http.HttpServletResponse response)
ITEM_TYPE
and matching the specified Condition
.condition
- the condition the items must satisfyvalidate
- optional parameter, in case of draft condition that have missing required parameters an IllegalArgumentException is throw
and this end point will return status code 400, to avoid that you can set validate to false.type
- the String representation of the item type we want to retrieve the count of, as defined by its class' ITEM_TYPE
fieldresponse
- the httpServletResponseItem for a discussion of {@code ITEM_TYPE}
Copyright © 2014–2023 Apache Software Foundation. All rights reserved.