Diversify products based on certain criteria for Multi Search API
Selectively diversify products from the search results, if both the user's input & product's meta data matches the criteria stated in the parameter diversity.
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 pin & hide for some products Pin & hide will be triggered if at least one of the input matches the criteria. If you want this filtering to be triggered for all search request, then set the conditions as |
type |
If you want to diversify the products by it's catalog metadata, choose |
field | If you have chosen meta, the expected value should be your catalog field alias name with a prefix of data.If you have chosen visual, the expected value should be image_similarity |
weight | This will determine how much to diversify based on this criteria. |
curl 'https://multimodal.search.rezolve.com/v1/product/multisearch?placement_id=xxx&app_key=xxx&q=xxx' \
--form 'diversity="[
{
\"conditions\":
[
\"input.text_query contains \\\"shirt\\\"\",
\"input.text_query == \\\"dress\\\"\"
],
\"type\": \"meta\",
\"field\": \"data.colors\",
\"weight\": 0.12
},
{
\"conditions\":
[
\"true\"
],
\"type\": \"meta\",
\"field\": \"data.brand\",
\"weight\": 1
},
{
\"conditions\":
[
\"true\"
],
\"type\": \"visual\",
\"field\": \"image_similarity\",
\"weight\": 1
}
]"'
- weights must be between the range of 0 ~ 1 and are truncated to 2 decimal places.
- the effect of diversity is capped relatively to the similarity score of the query.