When applying re-ranking filters using the "is not" condition, using the OR operator can lead to confusing and unintended behavior. This is because a product will be re-ranked if it satisfies just one of the conditions, regardless of whether it satisfies another or not.
Why OR with "is not" is problematic:
- When you say
category_page_id is not A OR category_page_id is not B
, a product will still be re-ranked if it satisfies just one of the filter conditions. - A product in category A will still be re-ranked because it does not belong to category B, and vice versa.
Why AND works better:
- When using
category_page_id is not A AND category_page_id is not B
, a product will only be re-ranked if it does not belong to both A and B. - A product in category A will not be re-ranked because, even though it does not belong to category B it still belongs to category A. Similarly, a product in category B will not be re-ranked because it still belongs to B.
- Only products that do not belong to either category will be re-ranked.
Let’s say we have the following scenarios:
Scenario 1: Single "is not" condition
category_page_id is not "Men > Clothing > Jackets"
Products in "Men > Clothing > Jackets" are not re-ranked as there is only one condition to satisfy
Scenario 2: "is not: with OR operator
category_page_id is not "Men > Clothing > Jackets" OR category_page_id is not "Women > Bags > Shoulder Bags"
Products that should be not be re-ranked may still be:
Products in "Men > Clothing > Jackets" are re-ranked because they are not in the "Women > Bags > Shoulder Bags" category ie. they satisfy the category_page_id is not "Women > Bags > Shoulder Bags"
condition
Scenario 3: "is not" with AND operator
category_page_id is not "Men > Clothing > Jackets" AND category_page_id is not "Women > Bags > Shoulder Bags"
Products matching any excluded category are not re-ranked:
Products in "Men > Clothing > Jackets" are not re-ranked because as only products that do not belong to either category (i.e., they are in neither "Men > Clothing > Jackets" nor "Women > Bags > Shoulder Bags") will be re-ranked.
If using the "is not" condition, switching to the AND operator ensures that re-ranking behaves correctly. This way, products that satisfy all exclusion conditions will not be re-ranked.