wilhelmmedetz LauraH is correct that this is not a bug, but expected behaviour in Legend.
In outline view, filters with multiple “and” terms consider the ancestors of an item, up to but not including the item that is currently zoomed to, to determine a match. That’s described briefly in the “Filter” section of the help document, have you seen that?
In your example, ‘c’ has the #t3
tag, and has an ancestor ‘a’ with a #t1
tag, so it matches the filter. Thus ‘a’ is not collapsed, because it has a matching child.
Something not explained in the help is that it’s only the deepest item, the “this” item in the example, that’s actually a match, in the sense that all of its non-excluded descendants will be displayed (though possibly collapsed), while if the “filter” item had other non-matching children, they would be hidden. On the other hand, the status bar will show both as “items matching the filter”. If we start with this:
Then, with “collapse matches” on, we get:
The “this” item is a match, because it has “this”, and an ancestor with “filter”. The “and that” item is not hidden, because all non-excluded descendants of matching items are displayed. But “this” is collapsed because “and that” doesn’t match. On the other hand, “and that” is included in the total of 3 “items matching filter” in the status bar. Meanwhile, “not the other” his completely hidden, and not included in the “items matching filter” total. That’s because its parent, the “filter” item, is not a matching item - even though it is also included in the total of “items matching filter”. It seems there are some holes in the help documentation, and inconsistencies with the terminology within Legend, which can be confusing to new users. That’s partly because the filters were quite recently renovated, including the addition of the “collapse matches” setting. But the actual behaviour is basically as expected.
LauraH is also correct that in list view, only individual items matching all the filter terms will be shown, in other words, it doesn’t work across the hierarchy. That’s also not explained in the help document. But, as you know, it has disadvantages, like that you can’t see the descendants if you want to. Some people have suggested that there should be a way in outline view to constrain “and” matches to individual items, while still showing the hierarchy of those that match. So far there hasn’t been any agreement for how that would work in the user interface. You’re welcome to create a feature request, and describe how you see it working.