The filter response object

You get a response filter object in the Sitecore Discover Search and Recommendation response if you send a request The filter request object. The response returns content and facets according to the filters added to your request.

The Using search filters example has more information on how to use this object,

The following code shows the basic structure of the response filter object with a range filter applied:

{
    "filter": {
	"<filter_type>": {
		"display_name": "<display_name>",
		"value": [{
		    "filter_id": "<filter_value_id>"
		    "text": "<display_text>",
		    "min": 1,
		    "max": 10
                }]
	}
    }
}

Keys

Depending on your request you may see some or all response keys.

The following table describes the keys in the filter request object:

KeyTypeDescription
filter_typeFilter type objectReturns the filter_type sent in your request.

Filter type object

The following table describes the keys in the filter_type object:

KeyTypeDescription
display_namestringAlternate name to display the filter_type.

You can contact your support representative if you want the response to display a different name for the returned filter_type.
valueValue objectContains the values of the filtered item.

If you requested a range filter, this object returns the minimum and maximum values.

Value object

The following table describes the keys in the value object:

KeyTypeDescription
filter_idstringA unique ID that corresponds to the filter value.Use the filter_id to filter future requests.NoteIf a facetobject is sent in the request, the filter_id in the filter response is the same as the id in the facet response.
textstringAlternate name to display the <filter_type>.
minnumberThe minimum value in a range.The response returns this only when the <filter_type> supports a range. For example, price.
maxnumberThe maximumvalue in a range.The response returns this only when the filter_type supports a range. For example, price.

Filter types

The following are default filters that come with all implementations. You can define additional facet types that are specific to your business when you do the initial data feed

Filter typeDescription
brandFilter by product brands.
category_namesFilter by product category names.
priceFilter by price or price range.
ratingFilter by product review rating. You must specify a min and a max.
If you have suggestions for improving this article, let us know!