Class FacetComparatorProvider


  • public class FacetComparatorProvider
    extends java.lang.Object
    • Field Detail

      • FACET_ORDER_TO_COMPARATOR

        private final java.util.Map<com.funnelback.common.facetednavigation.models.FacetValuesOrder,​java.util.Comparator<Facet.CategoryValue>> FACET_ORDER_TO_COMPARATOR
    • Constructor Detail

      • FacetComparatorProvider

        public FacetComparatorProvider()
    • Method Detail

      • getComparator

        java.util.Comparator<Facet.CategoryValue> getComparator​(com.funnelback.common.facetednavigation.models.FacetValuesOrder orderToSortBy,
                                                                java.util.Optional<java.util.Comparator<Facet.CategoryValue>> customComparator)
      • makeComparatorChain

        java.util.Comparator<Facet.CategoryValue> makeComparatorChain​(java.util.List<com.funnelback.common.facetednavigation.models.FacetValuesOrder> ordersToSortBy,
                                                                      java.util.Optional<java.util.Comparator<Facet.CategoryValue>> customComparator)
        Creates a comparator by chaining the wanted comparators.
        Parameters:
        ordersToSortBy - The list describing the comparators wanted.
        Returns:
      • getComparatorWhenSortingValuesFromSingleCategory

        public java.util.Comparator<Facet.CategoryValue> getComparatorWhenSortingValuesFromSingleCategory​(java.util.List<com.funnelback.common.facetednavigation.models.FacetValuesOrder> ordersToSortBy)
        This is the comparator to use when we are sorting values that come from a Single CategoryDefinition.

        This one needs to ensure that even caparators that come after CATEGORY_DEFINITION_ORDER are used as we are comparing within the category definition.

        Parameters:
        ordersToSortBy -
        Returns:
      • getComparatorWhenSortingAllValus

        public java.util.Comparator<Facet.CategoryValue> getComparatorWhenSortingAllValus​(java.util.List<com.funnelback.common.facetednavigation.models.FacetValuesOrder> ordersToSortBy,
                                                                                          java.util.Optional<java.util.Comparator<Facet.CategoryValue>> customComparator)
        Gets the comparator to use when we are sorting on ALL category values. This comparator is expected to be able to sort values from all sources (ie all category definitions). In this case we need to be careful to ensure that sorting by CATEGORY_DEFINITION_ORDER still works.
        Parameters:
        ordersToSortBy -
        Returns: