Package de.cxp.ocs.elasticsearch.facets
Class NestedFacetCreator
java.lang.Object
de.cxp.ocs.elasticsearch.facets.NestedFacetCreator
- All Implemented Interfaces:
FacetCreator
- Direct Known Subclasses:
CategoryFacetCreator
,IntervalFacetCreator
,NestedCustomFacetCreator
,RangeFacetCreator
,TermFacetCreator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected de.cxp.ocs.elasticsearch.facets.NestedFacetCountCorrector
-
Constructor Summary
ConstructorsConstructorDescriptionNestedFacetCreator
(Map<String, FacetConfiguration.FacetConfig> facetConfigs, Function<String, FacetConfiguration.FacetConfig> defaultFacetConfigProvider) -
Method Summary
Modifier and TypeMethodDescriptionorg.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.protected abstract boolean
createFacet
(org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket facetNameBucket, FacetConfiguration.FacetConfig facetConfig, InternalResultFilter facetFilter, DefaultLinkBuilder linkBuilder) createFacets
(org.elasticsearch.search.aggregations.Aggregations aggResult, FilterContext filterContext, DefaultLinkBuilder linkBuilder) create facets from aggregation result.extractFacets
(org.elasticsearch.search.aggregations.bucket.terms.Terms facetNames, FilterContext filterContext, DefaultLinkBuilder linkBuilder) protected abstract String
protected abstract org.elasticsearch.search.aggregations.AggregationBuilder
getNestedValueAggregation
(String nestedPathPrefix) protected abstract boolean
isMatchingFilterType
(InternalResultFilter internalResultFilter) protected abstract boolean
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface de.cxp.ocs.elasticsearch.facets.FacetCreator
mergeFacets
-
Field Details
-
nestedFacetCorrector
protected de.cxp.ocs.elasticsearch.facets.NestedFacetCountCorrector nestedFacetCorrector
-
-
Constructor Details
-
NestedFacetCreator
public NestedFacetCreator(Map<String, FacetConfiguration.FacetConfig> facetConfigs, Function<String, FacetConfiguration.FacetConfig> defaultFacetConfigProvider)
-
-
Method Details
-
getNestedPath
-
getNestedValueAggregation
protected abstract org.elasticsearch.search.aggregations.AggregationBuilder getNestedValueAggregation(String nestedPathPrefix) -
onlyFetchAggregationsForConfiguredFacets
protected abstract boolean onlyFetchAggregationsForConfiguredFacets() -
correctedNestedDocumentCount
protected abstract boolean correctedNestedDocumentCount() -
isMatchingFilterType
-
createFacet
protected abstract Optional<Facet> createFacet(org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket facetNameBucket, FacetConfiguration.FacetConfig facetConfig, InternalResultFilter facetFilter, DefaultLinkBuilder linkBuilder) -
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
-
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
-
extractFacets
protected List<Facet> extractFacets(org.elasticsearch.search.aggregations.bucket.terms.Terms facetNames, FilterContext filterContext, DefaultLinkBuilder linkBuilder)
-