Grouping products based on certain criteria for Multi Search API (Complementary / Outfit recommendations)
Selectively grouping products in the search results, if both the user's input & product's meta data matches the criteria stated in the parameter pairing_rules.
There are a few reserved keywords that is used in the JSON expression for user's input or product's data comparison.
- please refer to this for more details: Conditional rules (Taxonomy)
| Data structure | Description |
|---|---|
conditions | List of expressions to determine if this search request should be grouped for some products Grouping will be triggered if at least one of the input matches the criteria. If you want this grouping to be triggered for all search request, then set the conditions as |
groups | List of The list of The product will be part of the group if at least one of the criteria matches |
Evaluating expression of input/product with partial dataIf the data that is meant to replace the keywords is missing, the entire expression will be considered as
false.Scenario:
- Given that the product has data of
brand="rezolve"andsub_brand=nullBad example:
- Given that expression is
product.data.brand == "rezolve" || product.data.sub_brand == "multisearch"- This expression would still be considered as
falseRecommended example:
- Rewriting by breaking the expression to a list
product.data.brand == "rezolve"product.data.sub_brand == "multisearch"- This will help the system to evaluate the expression in chunks where only 1 of it needs to be
true
Example request
curl 'https://multimodal.search.rezolve.com/v1/product/multisearch/complementary?placement_id=xxx&app_key=xxx&q=xxx' \
--form 'pairing_rules="[
{
\"conditions\":
[
\"input.image_category == \\\"bracelet\\\"\",
\"input.text_query == \\\"dress\\\"\"
],
\"groups\":
[
{
\"actions\":
[
\"product.data.price.value >= 100 && product.data.price.value <= 200\",
\"input.image_category == \\\"necklace\\\"\"
]
},
{
\"actions\":
[
\"input.image_category == \\\"ring\\\"\"
]
}
]
}
]"'