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:

RequestResponse
{
    "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:

Key

Type

Description

filter_type

Filter type object

Returns the filter_type sent in your request.

Filter type object

The following table describes the keys in the filter_type object:

Key

Type

Description

display_name

string

Alternate 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.

value

Value object

Contains 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:

Key

Type

Description

filter_id

string

A unique ID that corresponds to the filter value.

Use the filter_id to filter future requests.

Note

If a facetobject is sent in the request, the filter_id in the filter response is the same as the id in the facet response.

text

string

Alternate name to display the <filter_type>.

min

number

The minimum value in a range.

The response returns this only when the <filter_type> supports a range. For example, price.

max

number

The 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 type

Description

brand

Filter by product brands.

category_names

Filter by product category names.

price

Filter by price or price range.

rating

Filter by product review rating. You must specify a min and a max.

Do you have some feedback for us?

If you have suggestions for improving this article,