Package de.cxp.ocs.elasticsearch.facets
Class VariantFacetCreator
java.lang.Object
de.cxp.ocs.elasticsearch.facets.VariantFacetCreator
- All Implemented Interfaces:
FacetCreator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.elasticsearch.search.aggregations.AggregationBuilder
_buildAggregation
(Function<FacetCreator, org.elasticsearch.search.aggregations.AggregationBuilder> subAggCreatorCall) org.elasticsearch.search.aggregations.AggregationBuilder
buildAggregation
(FilterContext filterContext) Build aggregation that is necessary to create the according facets.org.elasticsearch.search.aggregations.AggregationBuilder
buildExcludeFilteredAggregation
(FilterContext filterContext, Set<String> excludeNames) Build aggregation that is necessary to create the facets, but not the ones in the exlude list.org.elasticsearch.search.aggregations.AggregationBuilder
buildIncludeFilteredAggregation
(FilterContext filterContext, Set<String> includeNames) Build aggregation that is necessary to create the facets specified by the includes list.createFacets
(org.elasticsearch.search.aggregations.Aggregations aggResult, FilterContext filterContext, DefaultLinkBuilder linkBuilder) create facets from aggregation result.mergeFacets
(Facet first, Facet second) Try to merge facets with same label.
-
Constructor Details
-
VariantFacetCreator
-
-
Method Details
-
buildAggregation
public org.elasticsearch.search.aggregations.AggregationBuilder buildAggregation(FilterContext filterContext) Description copied from interface:FacetCreator
Build aggregation that is necessary to create the according facets.- Specified by:
buildAggregation
in interfaceFacetCreator
- Returns:
- configured aggregation-builder
-
buildIncludeFilteredAggregation
public org.elasticsearch.search.aggregations.AggregationBuilder buildIncludeFilteredAggregation(FilterContext filterContext, Set<String> includeNames) Description copied from interface:FacetCreator
Build aggregation that is necessary to create the facets specified by the includes list.- Specified by:
buildIncludeFilteredAggregation
in interfaceFacetCreator
- Parameters:
includeNames
- names of data fields for which the aggregations should be built- Returns:
- configured aggregation-builder
-
buildExcludeFilteredAggregation
public org.elasticsearch.search.aggregations.AggregationBuilder buildExcludeFilteredAggregation(FilterContext filterContext, Set<String> excludeNames) Description copied from interface:FacetCreator
Build aggregation that is necessary to create the facets, but not the ones in the exlude list.- Specified by:
buildExcludeFilteredAggregation
in interfaceFacetCreator
- Parameters:
excludeNames
- names of data fields that MUST NOT be part of this aggregation- Returns:
- configured aggregation-builder
-
_buildAggregation
public org.elasticsearch.search.aggregations.AggregationBuilder _buildAggregation(Function<FacetCreator, org.elasticsearch.search.aggregations.AggregationBuilder> subAggCreatorCall) -
createFacets
public Collection<Facet> createFacets(org.elasticsearch.search.aggregations.Aggregations aggResult, FilterContext filterContext, DefaultLinkBuilder linkBuilder) Description copied from interface:FacetCreator
create facets from aggregation result.- Specified by:
createFacets
in interfaceFacetCreator
- Parameters:
aggResult
- ES aggregagtion resultfilterContext
- the filter contextlinkBuilder
- a link builder to create facet-entry-links- Returns:
- a list of facets that can be derived from the aggregation result
-
mergeFacets
Description copied from interface:FacetCreator
Try to merge facets with same label. If not possible, return Optional.empty.- Specified by:
mergeFacets
in interfaceFacetCreator
- Parameters:
first
- Facet Asecond
- Facet B- Returns:
- optionally a merged Facet, otherwise Optional::empty
-