For example in article collection you have properties for #A and #B (2 properties), then add another property which is binary total, so if this article only related to #A, fill this binary total with 10, if it also related to #B, put 11 instead.
If only related to #B, not to #A, put 1, if not related to any of that, put 0.
So you can have filter here, if you want either of them, just choose 10 or 1.