E
- the generic type of the entities being queriedpublic class ElasticPageHelper<E extends sirius.db.es.ElasticEntity> extends BasePageHelper<E,sirius.db.es.constraints.ElasticConstraint,sirius.db.es.ElasticQuery<E>,ElasticPageHelper<E>>
elastic queries
.
Most notably this supports various aggregations for facets out of the box.
baseQuery, ctx, DEFAULT_PAGE_SIZE, facets, pageSize, searchFields
Modifier | Constructor and Description |
---|---|
protected |
ElasticPageHelper(sirius.db.es.ElasticQuery<E> query) |
Modifier and Type | Method and Description |
---|---|
ElasticPageHelper<E> |
addTermAggregation(sirius.db.mixing.Mapping field)
Adds a automatic facet for values in the given field.
|
ElasticPageHelper<E> |
addTermAggregation(sirius.db.mixing.Mapping field,
int numberOfBuckets)
Adds a automatic facet for values in the given field.
|
ElasticPageHelper<E> |
addTermAggregation(String title,
sirius.db.mixing.Mapping field,
sirius.kernel.cache.ValueComputer<String,String> translator,
int numberOfBuckets)
Adds a automatic facet for values in the given field.
|
ElasticPageHelper<E> |
addTimeAggregation(sirius.db.mixing.Mapping field,
sirius.db.mixing.DateRange... ranges)
Adds a time series based aggregation.
|
ElasticPageHelper<E> |
addTimeAggregation(sirius.db.mixing.Mapping field,
String title,
sirius.db.mixing.DateRange... ranges)
Adds a time series based aggregation.
|
protected void |
fillPage(sirius.kernel.commons.Watch w,
sirius.web.controller.Page<E> result,
List<E> items) |
static <E extends sirius.db.es.ElasticEntity> |
withQuery(sirius.db.es.ElasticQuery<E> baseQuery)
Creates a new instance with the given base query.
|
addBooleanFacet, addFacet, addFacet, addFilterFacet, addTimeFacet, applyFacets, asPage, createTimeFacet, enforcePaging, executeQuery, setupPaging, withContext, withPageSize, withSearchFields
protected ElasticPageHelper(sirius.db.es.ElasticQuery<E> query)
public static <E extends sirius.db.es.ElasticEntity> ElasticPageHelper<E> withQuery(sirius.db.es.ElasticQuery<E> baseQuery)
E
- the generic entity type being queriedbaseQuery
- the initial query to executepublic ElasticPageHelper<E> addTermAggregation(sirius.db.mixing.Mapping field)
field
- the field to aggregate onpublic ElasticPageHelper<E> addTermAggregation(sirius.db.mixing.Mapping field, int numberOfBuckets)
field
- the field to aggregate onnumberOfBuckets
- the maximal number of buckets collect and returnpublic ElasticPageHelper<E> addTimeAggregation(sirius.db.mixing.Mapping field, sirius.db.mixing.DateRange... ranges)
field
- the field to filter onranges
- the ranges which are supported as filter valuespublic ElasticPageHelper<E> addTimeAggregation(sirius.db.mixing.Mapping field, String title, sirius.db.mixing.DateRange... ranges)
field
- the field to filter ontitle
- the title of the filter shown to the userranges
- the ranges which are supported as filter valuespublic ElasticPageHelper<E> addTermAggregation(String title, sirius.db.mixing.Mapping field, sirius.kernel.cache.ValueComputer<String,String> translator, int numberOfBuckets)
title
- the title to use for the facetfield
- the field to aggregate ontranslator
- the translator used to convert field values into filter labelsnumberOfBuckets
- the maximal number of buckets collect and returnprotected void fillPage(sirius.kernel.commons.Watch w, sirius.web.controller.Page<E> result, List<E> items)
fillPage
in class BasePageHelper<E extends sirius.db.es.ElasticEntity,sirius.db.es.constraints.ElasticConstraint,sirius.db.es.ElasticQuery<E extends sirius.db.es.ElasticEntity>,ElasticPageHelper<E extends sirius.db.es.ElasticEntity>>
Copyright © 2018. All rights reserved.