Facets structure

{
"request": {
...
},
"response": {
"facets": [
{
"name": "Brand",
"display_name": "Brand",
"type": "multiple",
"data": {},
"options": [
{
"value": "Natural Balance",
"display_name": "Natural Balance",
"data": {},
"status": "",
"count": 8
},
{
"value": "WholeHearted",
"display_name": "WholeHearted",
"data": {
"image_url": "https://www.example.com/image.png"
},
"status": "selected",
"count": 10
}
]
},
{
"name": "rating",
"display_name": "Rating",
"type": "single",
"data": {},
"options": [
{
"value": "4-inf",
"display_name": "4 and more",
"data": {},
"status": "",
"count": 13,
},
{
"value": "3-inf",
"display_name": "3 and more",
"status": "selected",
"data": {},
"count": 16,
},
{
"value": "2-inf",
"display_name": "2 and more",
"status": "",
"data": {},
"count": 18,
},
{
"value": "1-inf",
"display_name": "1 and more",
"data": {},
"status": "",
"count": 19,
},
]
},
{
"name": "price",
"display_name": "Price",
"type": "range",
"data": {},
"min": 0,
"max": 265,
"status": {
"min": 100,
"max": 200,
}
}
],
"groups": [
...
],
"sort_options": [
...
],
"results": [
...
],
"total_num_results": 10
}
}

Facets fields#

field_nameAlways present?Description
nameYesThe name of the facet. This should be passed in the filters parameter when a facet of this type is selected. filters[name]=value
display_nameYesThe display name of the facet. This can be used for displaying the facet name, but it's not necessarily the value that needs to be passed in filters.
typeYesEither "single", "multiple", or "range". If a facet is of type single, then only one of the options may be selected (e.g: display as radio button). If the type is multiple, then multiple options may be selected (e.g: display as checkboxes). If the type is range, then no options are provided. Instead a min and max value is provided to specify the range of values that can be sent in filters. To configure the types of your facets, please reach out to support@constructor.io.
statusNoObject containing min and max values. Only provided at the facet field level for facets of type range. Specifies the currently selected range. If no range is currently selected, status will be an empty object ({})
optionsNoThe list of possible facet values matching this search. Only provided if type is single or multiple. By default, facet options are sorted by relevance. To configure the sort order of your facet options, please reach out to support@constructor.io.
dataYesObject containing custom data associated with this facet. An empty object ({}) if no data is currently associated with this facet. If you need help associating custom data with your facets, please reach out to support@constructor.io.

Facet option fields#

field_nameAlways present?Description
valueYesThe value that should be passed in filters to select this option: filters[name]=value
display_nameYesDisplay name of the facet option. This can be used for displaying the facet option, but it's not necessarily the value that needs to be passed in filters
statusYes"selected" if this option is selected in the current search request, empty string ("") otherwise.
dataYesObject containing custom data associated with this facet option. An empty object ({}) if no data is currently associated with this option. If you need help associating custom data with your facet options, please reach out to support@constructor.io.
countYesNumber of items in the current search that match this option.