facets


facetsArray<FacetResult>Read-only

Returns the facet results retrieved by the search.

The facet results provide grouping information for documents returned by the search, based on the requested facets.

Facet results are structured as follows:

Each facet specified in the facets() function returns a single facet result. Each facet result includes a facet group containing the name of the specified facet and an array of facets listing the number of documents matching each facet value.

The following example shows the facet results for a store product search for which collections and onSale were specified as facets:

"facets": [ { "facet": "collections", "facets": [ { "facetValue": "Boots", "count": 13 }, { "facetValue": "Running Shoes", "count": 22 }, { "facetValue": "Sandals", "count": 18 } ] }, { "facet": "onSale", "facets": [ { "facetValue": "true", "count": 17 }, { "facetValue": "false", "count": 36 } ] } ]

When no facets are specified in the facets() function, the returned facets array is empty.

Did this help?