Boost products based on certain criteria while still maintaining relevancy to the user's query for Multi Search API
Selectively boosting products up the search results, if both the user's input & product's meta data matches the criteria stated in the parameter boosts_attrs_v2.
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 boosted for some products Boosting will be triggered if at least one of the input matches the criteria. If you want this boosting to be triggered for all search request, then set the conditions as |
actions | List of expressions to determine which product should be boosted. Boosting will be applied to the product if at least one of the product matches the criteria. |
weight | This will determine how much to boost the product up to the top. |
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?placement_id=xxx&app_key=xxx&q=xxx' \
--form 'boosts_attrs_v2="[
{
\"conditions\":
[
\"input.text_query contains \\\"shirt\\\"\",
\"input.text_query == \\\"dress\\\"\"
],
\"actions\":
[
\"product.data.price.value >= 100 && product.data.price.value <= 200\",
\"(\\\"fashion\\\" in product.data.category) && \!(product.data.discount > 0.2) \",
\"product.data.brand == \\\"rezolve\\\"\",
\"product.data.sub_brand == \\\"multisearch\\\"\"
],
\"weight\": 0.11
}
]"'
Note
- weights must be between the range of 0 ~ 1 and are truncated to 2 decimal places.
- the effect of boosting is capped relatively to the similarity score of the query.