When creating Facets inside a Views filter, Views adds an extra nested conditionGroup.

Search api DB does not take into account this nested conditionGroup, which causes wrong behaviour when rendering the Facets. (Hiding facet items in the same group when 1 facet item is clicked).

Issue fork search_api-3477020

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

strykaizer created an issue. See original summary.

strykaizer’s picture

Issue tags: +Barcelona2024
strykaizer’s picture

Status: Active » Needs review

drunken monkey made their first commit to this issue’s fork.

drunken monkey’s picture

Title: Search api DB does not support nested conditionGroups » Search API DB does not support tags on nested condition groups

Thanks a lot for posting this issue and the MR fixing it!

Seems very sensible to me. The fact that tags on nested condition groups are ignored is clearly an oversight.
However, your code would still ignore tags nested more than one level deep (even though there is currently no use case for that). Instead, I suggest adding a new helper method and just calling it recursively – I think that would also make the code a bit cleaner.
I’m also adding a regression test.

Updated the MR, please test/review.

drunken monkey’s picture

Component: General code » Database backend
drunken monkey’s picture

strykaizer’s picture

Status: Needs review » Reviewed & tested by the community

Tested and fixes the issue.
Recursion is of course the way to go

Thanks for looking into this so quickly Thomas!
This will make a new release for Facets 3.x go much smoother ;)

drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

Good to hear, thanks for reporting back so quickly!
Merged. Thanks again!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.