Class VariantFacetCreator

java.lang.Object
de.cxp.ocs.elasticsearch.facets.VariantFacetCreator
All Implemented Interfaces:
FacetCreator

public class VariantFacetCreator extends Object implements FacetCreator
  • Constructor Details

  • 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 interface FacetCreator
      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 interface FacetCreator
      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 interface FacetCreator
      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 interface FacetCreator
      Parameters:
      aggResult - ES aggregagtion result
      filterContext - the filter context
      linkBuilder - a link builder to create facet-entry-links
      Returns:
      a list of facets that can be derived from the aggregation result
    • mergeFacets

      public Optional<Facet> mergeFacets(Facet first, Facet second)
      Description copied from interface: FacetCreator
      Try to merge facets with same label. If not possible, return Optional.empty.
      Specified by:
      mergeFacets in interface FacetCreator
      Parameters:
      first - Facet A
      second - Facet B
      Returns:
      optionally a merged Facet, otherwise Optional::empty