Grouping
Group results by values of a specified attribute
Last updated
Group results by values of a specified attribute
Last updated
This feature is only available for the Product Suggest API
The groupBy
parameter allows to group the results by values of any single-valued facetable attribute. Each value will return a group of items containing this value.
Name
Type
Is Required ?
groupBy
GroupOptions
✅
groupBy
Grouping options, must be a JSON object with the following properties:
attribute
string
Name of the attribute used for grouping
values
list of string
List of values (of the attribute) to group by
size
integer
Size of each group. Must be between 1 and 100 (inclusive)
The maximum number of items returned is 100, no matter the size
or number of values
. For example, requesting 50 values
with size
5 will return only 2 items per group (and 50 groups)
attribute
must be a single-valued facetable attribute. Lists and sets attributes can't be used for grouping
All responses from XO Search uses the same format. Check page for a more detailed description of this format.
Group results by 2 different kind
: "box"
and "product"
NodeJS / NPM example
HTML example