The triggering of one rule cannot be used as a condition for another rule.
For example, you might have a use case where you would like your first rule to be applied unless the second rule is triggered.
- RULE 1: Hide a particular set of records for any query
- RULE 2: If the user query matches a value of a specific attribute (ie: a SKU), disregard Rule 1
Although rules cannot currently serve this particular use case, there are two other approaches potential solutions:
- Use programmatic logic in your front-end to detect whether a user query matches the attribute value, and apply a search filter that includes/excludes the necessary records based on that logic. (Our documentation on Filtering By Tags and Using Boolean Operators with Filters may also be helpful for this approach.)
- Use multi-index search to prevent the "hidden" products from appearing unless there is a match on the specified attribute value.
- Create a replica index and update the configuration on the replica index so that specified attribute is the only searchable attribute.
- Implement the original rule #1 on the primary index (hide a particular set of records) and make sure that you are not forwarding rules to your replica.
- Re-implement your search request to search multiple indices: the original and the replica.
last reviewed Oct. 4, 2022
Article is closed for comments.