Interface CustomFacetCreator

All Known Implementing Classes:
FixedIntervalFacetCreator

public interface CustomFacetCreator
  • Method Summary

    Modifier and Type
    Method
    Description
    org.elasticsearch.search.aggregations.AggregationBuilder
    buildAggregation(String fullFieldName)
    Build the (sub)-aggregation that should be applied on the values of each field with that facet-type.
    createFacet(org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket facetNameBucket, FacetConfiguration.FacetConfig facetConfig, InternalResultFilter facetFilter, LinkBuilder linkBuilder, Function<org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation.Bucket,Long> nestedValueBucketDocCountCorrector)
    Create a facet from the given aggregation result.
    Specify for which field type this creator works.
    Return unique type name of facets that this creator can handle.
    mergeFacets(Facet first, Facet second)
    In case such a custom facet should be created on a field that is indexed on variant and master level, two facets are created and should be merged.
  • Method Details

    • getFacetType

      String getFacetType()
      Return unique type name of facets that this creator can handle. That is the type that must be used in the facet configuration for a facet to have this creator building the according facet. It MUST NOT be one of the reserved facet types 'term', 'interval', 'range', 'hierarchical' or 'ignore'.
      Returns:
      type name
    • getAcceptibleFieldType

      FieldType getAcceptibleFieldType()
      Specify for which field type this creator works. Must be one of: STRING, NUMBER, CATEGORY. A facet creator can not work for different field types - in that case different implementation of the facet-creator with different
      Returns:
    • buildAggregation

      org.elasticsearch.search.aggregations.AggregationBuilder buildAggregation(String fullFieldName)
      Build the (sub)-aggregation that should be applied on the values of each field with that facet-type. The same aggregation is used for all facets of that type.
      Parameters:
      fullFieldName - the 'full value field name' to be used as aggregation field-name.
      Returns:
    • createFacet

      Optional<Facet> createFacet(org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket facetNameBucket, FacetConfiguration.FacetConfig facetConfig, InternalResultFilter facetFilter, LinkBuilder linkBuilder, Function<org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation.Bucket,Long> nestedValueBucketDocCountCorrector)
      Create a facet from the given aggregation result.
      Parameters:
      facetNameBucket - The terms bucket of that facet field. The key of that bucket is the field name. It contains the required aggregation results as sub-aggregation.
      facetConfig - the config of the facet to be created
      facetFilter - a nullable filter if there is a filter applied for facet. Necessary to set the according values as selected.
      linkBuilder - a helper to create links for facet values / filters.
      Returns:
      facet if it can be created otherwise an empty optional.
    • mergeFacets

      Optional<Facet> mergeFacets(Facet first, Facet second)
      In case such a custom facet should be created on a field that is indexed on variant and master level, two facets are created and should be merged. If that is not possible feel free to log an error and return Optional.empty or just one of those facets.
      Parameters:
      first -
      second -
      Returns: