Appearance
Faceting
Faceting refers to the ways in which a user may narrow down the results of a search on the basis of certain criteria.
This is done by specifying a number of faceting options in the search request, which then returns a dynamic list of facets for the user to choose from.
The faceting options also return information on the amount of entities related to each facet. This helps give the user a quick overview of their options when browsing.
Faceting is distinct from filters in that filtering happens before Relewise returns results (such as in the case of a Merchandising filter rule or similar), while faceting is an option presented to the user, to narrow the scope of the results available.
For information on how to implement faceting, refer to our examples section.
Faceting is dependent on referencing the correct data types to return results. If you are uncertain of the data type being used in a particular data field, you can double-check by going to the entities page of MyRelewise and hovering over the field in question.
Data String Facets
(ProductDataStringValueFacet
, ContentDataStringValueFacet
, ProductCategoryDataStringValueFacet
)
Facet on the basis of a string value on product, content, or product category entities.
Usecase Example
Allow users to facet on product color, type, style, etc.
Data Boolean Facets
(ProductDataBooleanValueFacet
, ContentDataBooleanValueFacet
, ProductCategoryDataBooleanValueFacet
)
Facet on the basis of a boolean value product, content, or product category entities.
Usecase Example
Allow users to facet on whether a product is in stock or not.
Data Double Facets
(ProductDataDoubleValueFacet
, ContentDataDoubleValueFacet
, ProductCategoryDataDoubleValueFacet
)
Facet on the basis of a Double value on product, content, or product category entities.
Contrast with the Data Double Range facet, which presents Double values on a sliding scale, or the Data Double Ranges facet, which presents Double values in a series of pre-defined intervals.
Usecase Example
Allow users to facet on single values with decimals, such as length or height.
Data Integer Facets
(ProductDataIntegerValueFacet
, ContentDataIntegerValueFacet
)
Facet on the basis of an integer value on product, content, or product category entities.
Usecase Example
Allow users to facet on a value without decimals, such as shoe size or year.
Variant Specification Facet
(VariantSpecificationFacet
)
Facet on the specifications of variants.
Usecase Example
Allow users to facet on color, size, material etc. on variant products.
Brand Facet
(BrandFacet
)
Facet on the brand data of product entities.
Usecase Example
Allow users to choose which brands they want to see products from in their search.
Assortment Facets
(ProductAssortmentFacet
, ContentAssortmentFacet
, ProductCategoryAssortmentFacet
)
Facet on the assortments of product or content entities.
Price Range Facet
(PriceRangeFacet
)
Facet on the basis of a single, continuous range of prices. The upper and lower limits of the range is defined by the highest and lowest value found among the entities returned in the search query.
Usecase Example
Allow users to facet on a price-slider with a minimum and maximum price.
Price Ranges Facet
(PriceRangesFacet
)
Facet on the basis of a series of pre-defined price ranges. The upper and lower limits of the ranges are defined in the facet settings themselves; see Data Double Ranges Facet for a practical example of this.
Usecase Example
Allow users to facet on a series of set price intervals.
Data Double Range Facets
(ProductDataDoubleRangeFacet
, ContentDataDoubleRangeFacet
, ProductCategoryDataDoubleRangeFacet
)
Facet on the basis of a range of Double values. The upper and lower limits of the range is defined by the highest and lowest value found among the entities returned in the search query.
Contrast with the Data Double Facets, which creates a list of faceting options based on the values available on the entities.
Data Double Ranges Facets
(ProductDataDoubleRangesFacet
, ContentDataDoubleRangesFacet
, ProductCategoryDataDoubleRangesFacet
)
Facet on the basis of a series of pre-defined Doubles ranges. The upper and lower limits of the ranges are defined in the facet settings themselves - see example below.
Contrast with the Data Double Facets, which creates a list of faceting options based on the values available on the entities.
Usecase Example
Allow users to facet on product size, with height or width listed in a series of pre-defined value ranges.
csharp
searchRequest.Facets.AddDataDoubleRanges(
DataSelectionStrategy.Product,
key: "Height",
predefinedRanges: new List<ChainableRange<double?>>() {
new ChainableRange<double?>(0, 10),
new ChainableRange<double?>(10, 30),
new ChainableRange<double?>(30, 50)
},
expandedRangeSize: 20);
ts
request.facets(f => f.addProductDataDoubleRangesFacet(
'Height',
'Product',
[
{lowerBound: 0, upperBound: 10},
{lowerBound: 10, upperBound: 30},
{lowerBound: 30, upperBound: 50},
],
20,
));
php
$searchRequest->setFacets(
ProductFacetQuery::create()
->addToItems(
ProductDataDoubleRangesFacet::create(
key: "Height",
dataSelectionStrategy: DataSelectionStrategy::Product,
predefinedRanges: array(
floatChainableRange::create(0, 10),
floatChainableRange::create(10, 30),
floatChainableRange::create(30, 50),
),
expandedRangeSize: 20
)
)
);
You can also use the ExpandedRangeSize
flag to fill out the predefined ranges with numbers in a defined interval, if any are found that are not defined in the PredefinedRanges array.
By setting UpperBoundExclusive
to NULL
, it will select anything above the lowerbound - allowing you to make facets for "any value above X"
Data Object Facets
(ProductDataObjectFacet
, ContentDataObjectFacet
, ProductCategoryDataObjectFacet
)
Facet on the basis of a data field found within a data object on product, product category, or content entities.
Faceting on data objects is an advanced option, and we strongly recommend that you reach out to us if you wish to employ this type of faceting.
Usecase Example
Allow users to facet by which physical store a product is available in.
Category Facet
(CategoryFacet
)
Facet on the categories associated with the entities returned in the query.
example
When searching for black
, allow the user to select whether they want to see products from category Paint
, Fabric Swatches
, Clothes
Category Hierarchy Facet
(CategoryHierarchyFacet
)
Facet on the categories associated with the entities returned in the query, as well as the categories relative to these categories in the hierarchy.
Usecase Example
When searching for black
, allow the user to select whether they want to see products from category Paint
, Fabric Swatches
, Clothes
, and/or from related subcategories:
Paint -> Acryllic Paint
Paint -> Oil Paint
Fabric Swatches -> Fur
Fabric Swatches -> Leather
Fabric Swatches -> linen
Faceting Settings
Faceting settings allow you to adjust how your facets function. The current faceting settings are:
includeZeroHitsInAvailable
If true
, the query will return facets even if they have zero hits. This is useful for, e.g., showing a user all the different brands available on the site.
alwaysIncludeSelectedInAvailable
If true
, selected facets will remain available even if they no longer returns hits. Useful for UX to ensure selected facets are not unchecked when the user narrows their search.