Class Facet
java.lang.Object
com.broadleafcommerce.search.api.domain.Facet
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.ContextStateAware
,Serializable
public class Facet
extends Object
implements Serializable, com.broadleafcommerce.data.tracking.core.ContextStateAware
This represents an available search facet and its filtering options. This can represent any
property that is filterable. For example, this could represent an item like Color, Manufacturer,
Price, etc.
Since 2.1.0-GA, Facets are managed as independent entities from FieldDefinitions
rather than being embedded.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
Miscellaneous attributes for this facet.com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState
A subset ofTracking
information to expose the context state for this object.Order in which to display this facet on a list of facets.The rule required to be met for this facet to be active.getField()
TheFieldRef
this facet belongs to.getId()
The context ID of the facet.getLabel()
A value intended for display on a UI.getName()
Name to use to identify the facet.The different range options available for filtering on this search facet.The field variant type which should be faceted on.int
hashCode()
boolean
Determines whether or not this facet allows multiple values to be selected.boolean
isRanged()
Designates whether or not this facet is ranged.boolean
void
setAttributes
(Map<String, Object> attributes) Miscellaneous attributes for this facet.void
setContextState
(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) A subset ofTracking
information to expose the context state for this object.void
setDisplayOrder
(Integer displayOrder) Order in which to display this facet on a list of facets.void
setFacetRule
(String facetRule) The rule required to be met for this facet to be active.void
TheFieldRef
this facet belongs to.void
The context ID of the facet.void
A value intended for display on a UI.void
setMultiSelect
(boolean multiSelect) Determines whether or not this facet allows multiple values to be selected.void
Name to use to identify the facet.void
setRanged
(boolean ranged) Designates whether or not this facet is ranged.void
setRanges
(List<FacetRange> ranges) The different range options available for filtering on this search facet.void
setVariantType
(String variantType) The field variant type which should be faceted on.toString()
-
Constructor Details
-
Facet
public Facet()
-
-
Method Details
-
isRuledFacet
public boolean isRuledFacet() -
getFieldDefinitionId
-
getFieldIndexableType
-
getId
The context ID of the facet.- Returns:
- the context ID of the facet
-
getField
TheFieldRef
this facet belongs to. This is null if not usingSearchSettings
. Onlyid
,indexableType
, andlabel
are serialized in API responses.- Returns:
- field to be sorted on
-
getLabel
A value intended for display on a UI. For example, "Manufacturer", "Price", "Category", etc.- Returns:
- displayable label for this facet
-
getName
Name to use to identify the facet. Typically, this should correspond to aFieldDefinition.getAbbreviation()
.- Returns:
- Name to use to identify the facet.
-
getVariantType
The field variant type which should be faceted on.- Returns:
- the variant type which should be faceted on
-
getDisplayOrder
Order in which to display this facet on a list of facets. A lower number indicates this item will occur earlier in the returned facet list.- Returns:
- order in which this facet should appear in a list
-
isMultiSelect
public boolean isMultiSelect()Determines whether or not this facet allows multiple values to be selected.- Returns:
- can multiple options of this facet be selected?
-
isRanged
public boolean isRanged()Designates whether or not this facet is ranged. For example price might be a ranged facet ($0.00-49.99, $50.00-99.99, etc), or date ranges.- Returns:
- is this a ranged facet?
-
getRanges
The different range options available for filtering on this search facet.- Returns:
- available range options for this facet
-
getFacetRule
The rule required to be met for this facet to be active. This is by default a SpEL expression, but may be any expression language.- Returns:
- The facet rule.
- See Also:
-
getAttributes
Miscellaneous attributes for this facet.- Returns:
- Miscellaneous attributes for this facet.
-
getContextState
public com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState getContextState()A subset ofTracking
information to expose the context state for this object.- Specified by:
getContextState
in interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware
- Returns:
- a subset of
Tracking
information to expose the context state for this object
-
setId
The context ID of the facet.- Parameters:
id
- the context ID of the facet
-
setField
TheFieldRef
this facet belongs to. This is null if not usingSearchSettings
. Onlyid
,indexableType
, andlabel
are serialized in API responses.- Parameters:
field
- field to be sorted on
-
setLabel
A value intended for display on a UI. For example, "Manufacturer", "Price", "Category", etc.- Parameters:
label
- displayable label for this facet
-
setName
Name to use to identify the facet. Typically, this should correspond to aFieldDefinition.getAbbreviation()
.- Parameters:
name
- Name to use to identify the facet.
-
setVariantType
The field variant type which should be faceted on.- Parameters:
facetVariantType
- the variant type which should be faceted on
-
setDisplayOrder
Order in which to display this facet on a list of facets. A lower number indicates this item will occur earlier in the returned facet list.- Parameters:
displayOrder
- order in which this facet should appear in a list
-
setMultiSelect
public void setMultiSelect(boolean multiSelect) Determines whether or not this facet allows multiple values to be selected.- Parameters:
multiSelect
- can multiple options of this facet be selected?
-
setRanged
public void setRanged(boolean ranged) Designates whether or not this facet is ranged. For example price might be a ranged facet ($0.00-49.99, $50.00-99.99, etc), or date ranges.- Parameters:
ranged
- is this a ranged facet?
-
setRanges
The different range options available for filtering on this search facet.- Parameters:
ranges
- available range options for this facet
-
setFacetRule
The rule required to be met for this facet to be active. This is by default a SpEL expression, but may be any expression language.- Parameters:
facetRule
- The rule to evaluate.- See Also:
-
setAttributes
Miscellaneous attributes for this facet.- Parameters:
attributes
- Miscellaneous attributes for this facet.
-
setContextState
public void setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) A subset ofTracking
information to expose the context state for this object.- Specified by:
setContextState
in interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware
- Parameters:
contextState
- a subset ofTracking
information to expose the context state for this object
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-