Nested OR conditiongroups break facet results

Created on 18 November 2024, 5 days ago

Issue

Adding an OR conditiongroup in the view, breaks the query. Likely no results at all are returned from the query.

This is highly related to https://www.drupal.org/project/facets/issues/3485461 🐛 Nested AND conditiongroups break facet results Active , where the solution removes the root level conditiongroup. Normally this has an 'AND', and since this is the default, no issues there. However if an OR is used, this information is lost and an 'AND' is assumed. This results in less or no results.

Steps to reproduce

  • Create a view
  • Add a 2 filters f.e. content type='article' and Published=TRUE
  • Create a filtergroup with an 'OR' and seperate the two:
  • Note that this gives results
  • Create a facet as exposed filters
  • Note that the query gives 0 results
  • In FacetsExposedFiltersSubscriber queryAlter before:
  • In FacetsExposedFiltersSubscriber queryAlter after:
  • Note the OR has been removed.

Proposed resolution

No clue. I tried changing in /src/EventSubscriber/FacetsExposedFiltersSubscriber.php
$conditions = $conditions[0]->getConditions(); to $conditions = $conditions[0]; (So the 'OR' is kept), but that creates all sorts of other problems.

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇳🇱Netherlands arjenk

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024