Faceting

Faceting is a powerful tool for E-commerce website, find below how you can configure it with XO Search

circle-info

This feature is only available for the Search API

Parameters

The faceting parameters allows the developer to enable/disable faceting results, and to filter search results using specific facets values.

Name

Type

Is Required ?

Default value

facets

array

βœ–

empty array

facets

If specified, perform a search using the selected facets and values. This parameter must be an array of JSON objects. Each object should have the following properties:

Property
Type
Description

id

string

ID of the facet to select

values

array of string

Items should have at least one

of these values for the selected facet

"facets": [
    {
        "id": "facet-name",
        "values": ["string-value", ...]
    },
    ...
]

Notes

  • Unknown facets values will lead to empty responses.

circle-exclamation

Response

All responses from XO Search uses the same format. Check API Reference page for a more detailed description of this format.

API Referencechevron-right

Usage examples

Filter results based on facets values

  • Retrieve only items with the facet size set to one of the [46, 48, 50] values

NodeJS / NPM example

HTML example

  • Retrieve only items with the facet size set to 46 and the facet color set to one of [23, 26] values

NodeJS / NPM example

HTML example

Last updated