Show results by group for Multi Search API
You can group your <<glossary:results>> by a specified field.
- The field data type must be string format.
- Only one
group_by_v2field is allowed in each request. - Products with the similar metadata will collapse into a single product with variants field when
group_by_v2parameter is used. - Within each variants, the results are returned in descending order of relevance scores. Among different groups, by default the groups are ordered by the top result’s confidence score.
| Name | Type (Default Value) | Description |
|---|---|---|
group_by_v2 | String | The product metadata field used to group the search results. Only non-numerical fields are supported. |
group_limit | Integer (9) | The maximum number of variants displayed per product. |
example request
curl https://multimodal.search.rezolve.com/v1/product/multisearch \
-d im_url=http://example.com/example-0.jpg \
-F attrs_to_get=product_parent_id \
-F group_by_v2=product_parent_id \
-F score=true
example response
{
"reqid": "01a00e3f1e5ae0ac4b94970daa34c5",
"status": "OK",
"method": "product/multisearch",
"page": 1,
"limit": 10,
"total": 388,
"result":
[
{
"product_id": "12714766",
"main_image_url": "http://xx.com/test.jpg",
"data":
{
"product_parent_id": "parent_id_1"
},
"score": 0.43965054,
"variants":
[
{
"product_id": "12588828",
"main_image_url": "http://xx.com/test.jpg",
"data":
{
"product_parent_id": "parent_id_1"
},
"score": 0.42731023
}
]
}
]
}