Array filtering: Combine black/whitelisting --> (X AND Y) OR Z is not allowed - Issue

Hi there,

we have some products which are not available in certain countries. So our users can either define a region black- or whitelist to exclude an offer from specific regions. (We are a marketplace → The users are placing their offers by themselve)

The index now has region_blacklist, region_whitelist (Array of country codes each) and a user_id

How would an appropriate filter look like while a user should alway see his own offers (without considering his location)?

I always ran into the “(X AND Y) OR Z is not allowed” - Issue so far :confused:

Edit: For sure, an alternative would be to transform the whitelist into a blacklist as well and merge it. But this would lead to a quite huge array (~240 elements). Is that a problem?