Class Facet
- java.lang.Object
-
- com.funnelback.publicui.search.model.transaction.Facet
-
- Direct Known Subclasses:
FacetConverter.FacetWithFields
@XStreamConverter(FacetConverter.class) public class Facet extends Object
Facets, generated from the result data (Metadata counts, GScope counts, URL counts).
- Since:
- 11.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Facet.CategoryValue
Value of a facet category, such as "Location = Sydney".
-
Field Summary
Fields Modifier and Type Field Description private List<Facet.CategoryValue>
allValues
List of all facet values both selected and unselected.private @NotNull @NonNull FacetConstraintJoin
constraintJoin
private Comparator<Facet.CategoryValue>
customComparator
If non-null this comparator will be used to sort values returned by theFacet#getAllValues()
,getSelectedValues()
andFacet#getUnselectAllUrl()
methods.private Map<String,Object>
customData
Custom data placeholder allowing any arbitrary data to be stored for this facet by hook scripts.private @NotNull @NonNull FacetValues
facetValues
private @NotNull @NonNull FacetDisplayType
guessedDisplayType
The guessed type of the facet based on its configuration.private String
name
Facet name, for example "Location"private @NotNull @NonNull List<FacetValuesOrder>
order
private @NotNull @NonNull FacetSelectionType
selectionType
private String
unselectAllUrl
URL to use to unselect all possible values of this facet, built from the current URL
-
Constructor Summary
Constructors Constructor Description Facet(String name)
Deprecated.Facet(String name, FacetSelectionType selectionType, FacetConstraintJoin constraintJoin, FacetValues facetValues, List<FacetValuesOrder> order)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Facet.CategoryValue>
getSelectedValues()
boolean
hasValues()
Recursively check if this facet has any value at all.boolean
isSelected()
static <T> Stream<T>
ofNullableSingle(T a)
Clone from com.funnelback.common.function.StreamUtils.ofNullableSingle(T)String
toString()
-
-
-
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 URLThe URL is one where the facet is not selected, the URL may be used as the base URL to append to select values within the facet.
sSince 15.12
-
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
-
order
@NotNull @NonNull private @NotNull @NonNull List<FacetValuesOrder> order
- 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 theFacet#getAllValues()
,getSelectedValues()
andFacet#getUnselectAllUrl()
methods.This currently does not sort the values returned by any other method such as the values in what is returned by
Facet#getAllValues()
although this may change.- Since:
- 15.12
-
allValues
private final List<Facet.CategoryValue> allValues
List of all facet values both selected and unselected.- Since:
- 15.12
-
-
Constructor Detail
-
Facet
public Facet(String name, FacetSelectionType selectionType, FacetConstraintJoin constraintJoin, FacetValues facetValues, List<FacetValuesOrder> order)
-
Facet
@Deprecated public Facet(String name)
Deprecated.Backwards compatible constructor so the stencils facet will continue to work.- Parameters:
name
- facet name
-
-
Method Detail
-
getSelectedValues
public List<Facet.CategoryValue> getSelectedValues()
- Returns:
- List of selected values, useful to build breadcrumbs
- Since:
- 15.12
-
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)
-
isSelected
public boolean isSelected()
- Returns:
- True if any of the values of this facet is selected
- Since:
- 15.12
-
-