Class Facet

    • Field Detail

      • name

        private String name
        Facet name, for example "Location"
      • unselectAllUrl

        private String unselectAllUrl
        URL to use to unselect all possible values of this facet, built from the current URL

        The URL is one where the facet is not selected, the URL may be used as the base URL to append to to select values within the facet.

      • customData

        private final Map<String,​Object> customData
        Custom data placeholder allowing any arbitrary data to be stored for this facet by hook scripts.
      • selectionType

        @NotNull
        @NonNull
        private @NotNull @NonNull FacetSelectionType selectionType
        Since:
        15.12
      • constraintJoin

        @NotNull
        @NonNull
        private @NotNull @NonNull FacetConstraintJoin constraintJoin
        Since:
        15.12
      • facetValues

        @NotNull
        @NonNull
        private @NotNull @NonNull FacetValues facetValues
        Since:
        15.12
      • guessedDisplayType

        @NotNull
        @NonNull
        private @NotNull @NonNull FacetDisplayType guessedDisplayType
        The guessed type of the facet based on its configuration.

        This value can give an indication of how the facet should be displayed, for example SINGLE select where values come from a UNSCOPED query would give the value RADIO_BUTTON. The UI could use this to show the facets as radio buttons.

        If the guessedType is not the way you intend to show the facet you should ignore this value and instead use the facet name or other fields which describe the facet to work out what should be shown i.e. don't have code which is if(guessedType == TAB) then show the facet as checkboxes.

        Newer versions of Funnelback may change how the type is guessed.

        Since:
        15.12
      • customComparator

        private Comparator<Facet.CategoryValue> customComparator
        If non-null this comparator will be used to sort values returned by the getAllValues(), getSelectedValues() and Facet#getUnselectedValues() methods.

        This currently does not sort the values returned by any other method such as the values in what is returned by Facet#getCategories() although this may change.

        Since:
        15.12
    • Method Detail

      • getSelectedValues

        public List<Facet.CategoryValue> getSelectedValues()
        Returns:
        List of selected values, useful to build breadcrumbs
      • hasValues

        public boolean hasValues()
        Recursively check if this facet has any value at all.
        Returns:
        true if the facet possess at least one value.
      • ofNullableSingle

        public static <T> Stream<T> ofNullableSingle​(T a)
        Clone from com.funnelback.common.function.StreamUtils.ofNullableSingle(T)
        Type Parameters:
        T -
        Parameters:
        a -
        Returns:
      • isSelected

        public boolean isSelected()
        Returns:
        True if any of the values of this facet is selected
      • getName

        public String getName()
        Facet name, for example "Location"
      • setName

        public void setName​(String name)
        Facet name, for example "Location"
      • getUnselectAllUrl

        public String getUnselectAllUrl()
        URL to use to unselect all possible values of this facet, built from the current URL

        The URL is one where the facet is not selected, the URL may be used as the base URL to append to to select values within the facet.

      • setUnselectAllUrl

        public void setUnselectAllUrl​(String unselectAllUrl)
        URL to use to unselect all possible values of this facet, built from the current URL

        The URL is one where the facet is not selected, the URL may be used as the base URL to append to to select values within the facet.

      • getCustomData

        public Map<String,​Object> getCustomData()
        Custom data placeholder allowing any arbitrary data to be stored for this facet by hook scripts.
      • getSelectionType

        @NonNull
        public @NonNull FacetSelectionType getSelectionType()
        Since:
        15.12
      • getConstraintJoin

        @NonNull
        public @NonNull FacetConstraintJoin getConstraintJoin()
        Since:
        15.12
      • getFacetValues

        @NonNull
        public @NonNull FacetValues getFacetValues()
        Since:
        15.12
      • getGuessedDisplayType

        @NonNull
        public @NonNull FacetDisplayType getGuessedDisplayType()
        The guessed type of the facet based on its configuration.

        This value can give an indication of how the facet should be displayed, for example SINGLE select where values come from a UNSCOPED query would give the value RADIO_BUTTON. The UI could use this to show the facets as radio buttons.

        If the guessedType is not the way you intend to show the facet you should ignore this value and instead use the facet name or other fields which describe the facet to work out what should be shown i.e. don't have code which is if(guessedType == TAB) then show the facet as checkboxes.

        Newer versions of Funnelback may change how the type is guessed.

        Since:
        15.12
      • getCustomComparator

        public Comparator<Facet.CategoryValue> getCustomComparator()
        If non-null this comparator will be used to sort values returned by the getAllValues(), getSelectedValues() and Facet#getUnselectedValues() methods.

        This currently does not sort the values returned by any other method such as the values in what is returned by Facet#getCategories() although this may change.

        Since:
        15.12
      • setCustomComparator

        public void setCustomComparator​(Comparator<Facet.CategoryValue> customComparator)
        If non-null this comparator will be used to sort values returned by the getAllValues(), getSelectedValues() and Facet#getUnselectedValues() methods.

        This currently does not sort the values returned by any other method such as the values in what is returned by Facet#getCategories() although this may change.

        Since:
        15.12
      • getAllValues

        public List<Facet.CategoryValue> getAllValues()
        Returns:
        List of all facet values both selected and unselected.