Filter of type: (A AND B) OR (C AND D)


How would I go about performing a filter of the form (A AND B) OR (C AND D)?
I understand that such filters are not supported but is there any way to perform such a query through other means?


Hi @tanpinquan,

Indeed, you are right, we do not support filters in the form of (A AND B) OR (C AND D) because this logic is extremely costly for the engine and the resulting performance would be bad.

The best workaround is to perform two different queries, and then merge the results in your front-end:'your query', { filters: 'A AND B' }) 
-- AND --'your query', { filters: 'C AND D' }) 

This is not a great option but it allows you to get exactly these results.

We have also found out that the need for this specific logic is actually quite rare (although it can happen!) in real business use cases. Could you share more about your use case so that we can maybe think of another way to formulate the query?

Thanks in advance!