Class FacetSorting

java.lang.Object
io.goobi.viewer.model.search.FacetSorting

public final class FacetSorting extends Object
Class to create maps for facet values and their respective counts which are automatically sorted according to a given sort order. The maps are returned as a SortedMap class to signal that the map takes care of sorting its members
  • Method Details

    • getSortingMap

      public static final FacetSorting.SortingMap<String,Long> getSortingMap(Map<String,Long> map, String sortOrder)
      Creates a SortingMap on the basis of the given map and with the given sortOrder. Possible values for sortOrder are
      • numerical
      • alphabetical
      • alphanumerical
      • alphabetical_raw
      Each value can be suffixed by '_asc' or '_desc' to disignate that the sorting should be done ascending or descending, respectively. Default order is ascending alphabetical and alphanumerical orderings may use message keys to determine order and thus take longer to evaluate; use alphabetical_raw for a alphabetical ordering by the values alone, without considering message keys. Passing any other value for sortOrder keeps the original ordering of the values as they are added to the map.
      Parameters:
      map - Map containing values to sort
      sortOrder - sorting order
      Returns:
      a SortingMap, which automatically orders entries as they are added to the map
    • getSortingMap

      public static FacetSorting.SortingMap<String,Long> getSortingMap(String field, String sortOrder, Locale locale)
      Creates a SortingMap on the basis of the given field and locale and the given sortOrder. Possible values for sortOrder are
      • numerical
      • alphabetical
      • alphanumerical
      • alphabetical_raw
      Each value can be suffixed by '_asc' or '_desc' to disignate that the sorting should be done ascending or descending, respectively. Default order is ascending alphabetical and alphanumerical orderings may use message keys to determine order and thus take longer to evaluate; use alphabetical_raw for a alphabetical ordering by the values alone, without considering message keys. Passing any other value for sortOrder keeps the original ordering of the values as they are added to the map.
      Parameters:
      field - The solr-field which values are to be sorted. Affects which configuration options are used for ordering
      sortOrder - sorting order
      locale - the locale to use if translated values are to be used for ordering
      Returns:
      a SortingMap, which automatically orders entries as they are added to the map