Problem/Motivation

When a taxonomy exposed filter is active with a value, the request has a clause like 'taxonomy_xx != ' + "last value of taxonomy list " when he is combined with the same filter non exposed to filter datasource

Steps to reproduce

- Create Vocabulary XX
- Create terms x1, x2, x3, x4
- Add field taxonomy term to article content type with unlimited terms and attach Vocabulary_xx
- Create nodes with a couple of vocabulary terms
- Create view with articles
- Add filter for term field non exposed with x1, x2 and x3 selected values
- Add exposed filter for term field with x1, x2 and x3 selected values and "limit list to selection items" option checked

Result:
filters x1 and x2 work apparently well but x3 result is empty, if you check the query, there are a left join with 'taxonomy_xx != x3_id' in all request.
When x3 term is selected, request has a 'taxonomy_xx != x3_id' in left join and 'taxonomy_xx = x3_id' in where clause

CommentFileSizeAuthor
#3 query-filter.PNG34.11 KBmcalduch
query-no-filter.PNG27.01 KBmcalduch

Issue fork drupal-3401605

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

mcalduch created an issue. See original summary.

mcalduch’s picture

Issue summary: View changes
mcalduch’s picture

StatusFileSize
new34.11 KB
lendude’s picture

Title: Taxonomy Exposed filter causes inconsistent query » Exposed filter with options (term or option field) combined with unexposed filter on the same field builds broken query
Version: 9.0.x-dev » 11.x-dev
Issue tags: -views, -taxonomy term, -exposed filter

Confirmed on Umami install with the Difficulty field which isn't a term field, so any field that is rendered as select seems to be able to break this

lendude’s picture

Status: Active » Needs work

Added a fix and test coverage, but the fix seems to break something so need to look at that

lendude’s picture

The existing coverage breaks and shows too much when checking for the current value and the new coverage breaks if we don't check for this, trying to wrap my head around this but good to see the existing coverage is there

willabby changed the visibility of the branch 3401605-exposed-filter-with to hidden.

willabby changed the visibility of the branch 3401605-exposed-filter-with to active.

sakthi_dev made their first commit to this issue’s fork.

sakthi_dev’s picture

Resolved the conflicts.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.