I have an issue with a few exposed filters not working properly with each other. I haven't been able to figure out the pattern, but I created a new Drupal installation (7.4, with only Views 7.x-3.0-rc1 and CTools 7.x-1.0-beta1 added on), just to confirm the problem.
In my test, there are only 2 content items. The fields are set up like this:
Color
field_color
Term reference
Autocomplete term widget (tagging)
Shape
field_shape
List (text)
Check boxes/radio buttons
Part Number
field_partnumber
Term reference
Autocomplete term widget (tagging)
Color taxonomy terms are:
Red
-Maroon
-Burgandy
Blue
-Baby Blue
--Baby Blue Child
-Phthalo Blue
--Phthalo Blue Child
The search page is set up in Views, and the Filter Criteria all use AND joins:
Content: Published (Yes)
Content: Has taxonomy terms (with depth) (exposed) --- depth is set to "3"
Content: Shape (exposed)
Content: Part Number (exposed)
Here are a few test cases, which you can try out at: http://domainspring.com/sample/search
1) Shape: Circle (works)
2) Has taxonomy terms (with depth): Blue (works)
3) Has taxonomy terms (with depth): Phthalo Blue Child (works)
4) Has taxonomy terms (with depth): Blue *and* Shape: Circle (doesn't work - no results)
5) Has taxonomy terms (with depth): Phthalo Blue *and* Shape: Circle (doesn't work - no results)
6) Has taxonomy terms (with depth): Phthalo Blue Child *and* Shape: Circle (works)
7) Has taxonomy terms (with depth): Blue *and* Shape: Circle *and* Part Number: 1111 (works)
So, it looks like there is something strange going on (how #4 doesn't work, but if you tack on the part number, it works, etc.) Any ideas? I'd be happy to include the SQL queries or anything else about my setup, if that helps.
Thanks
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | views_export.txt | 7 KB | tj2653 |
Comments
Comment #1
merlinofchaos commentedCan you attach an export of the simplest view recreating this you can make?
Comment #2
tj2653 commentedAttached as a TXT file, thanks.
Comment #3
tj2653 commentedHere are SQL queries for some of the test cases:
1) Shape: Circle (works)
2) Has taxonomy terms (with depth): Blue (works)
4) Has taxonomy terms (with depth): Blue *and* Shape: Circle (doesn't work - no results)
7) Has taxonomy terms (with depth): Blue *and* Shape: Circle *and* Part Number: 1111 (works)
Comment #4
urbanhick commentedI am having this same issue. Can be replicated with a taxonomy of 3 terms no depth using the taxonomy with depth filter. Content tagged with one of the terms is only searchable with the -Any- selection, if it's actual taxonomy is searched no results are found.
Note that it works using the taxonomy without depth filter using the same settings.
Comment #5
dawehnerSeems to be a duplicate of #1112854: Subqueries use wrong arguments
Perhaps you could look at the sql output, which would help to understand it
Comment #6
peyrol commentedHello
I have some strange behavior with Views when one of filters is 'Has Filter Has taxonomy terms (with depth)' and one of sorting fields is enabled. I have no one row (and I should have) in output but pagination show some pages.
The key is that one field is defined by me, there is no problem with original field (just checked for created date time field).
First I think it has something with Exposed Filters, but I'd rather think it's something with joining the same table when depth is set.
Versions:
drupal 7.7
views 7.x-3.0-rc1
Best Regards
Przemek
Comment #7
dawehnerNeeds review means that there is a patch on the issue, update status.
please try to read http://drupal.org/node/571990 as this really helps other people to understand the issue.
Comment #8
peyrol commentedDid I made update status in right way?
Przemek
Comment #9
peyrol commentedHello
Below i put queries to database when exposed filter is set to user and when it is not.
This sql is for filter Has taxonomy terms (with depth) (= something) and sorting by data time field is exposed to user:
Return many rows. Sorting by name_of_filed_3_problematic is not defined at all.
This sql is for filter Has taxonomy terms (with depth) (= something) and sorting by data time field and sorting by name_of_filed_3_problematic is exposed to user:
Return 0 rows.
The difference is for working view setting :
WHERE ( (tn.tid = '1') OR (th1.tid = '1') OR (th2.tid = '1') OR (th3.tid = '1') OR (th4.tid = '1') OR (th5.tid = '1') OR (th6.tid = '1') OR (th7.tid = '1') OR (th8.tid = '1') OR (th9.tid = '1') OR (th10.tid = '1') ))) ))
and for not working view setting:
WHERE ( (tn.tid = '1') OR (th1.tid = 'machine_name_of_type_like_article') OR (th2.tid = '1') OR (th3.tid = '1') OR (th4.tid = '1') OR (th5.tid = '1') OR (th6.tid = '1') OR (th7.tid = '1') OR (th8.tid = '1') OR (th9.tid = '1') OR (th10.tid = '1') ))) ))
For putting 1 instead of machine_name_of_type_like_article in second WHERE clause it works fine.
One more thing is that, for two view settings there is count(*) query. For these queries WHERE are:
without sorting filed:
WHERE ( (tn.tid = '1') OR (th1.tid = '1') OR (th2.tid = '1') OR (th3.tid = '1') OR (th4.tid = '1') OR (th5.tid = '1') OR (th6.tid = '1') OR (th7.tid = '1') OR (th8.tid = '1') OR (th9.tid = '1') OR (th10.tid = '1') ))) ))) subquery
with sorting field by name_of_filed_3_problematic:
WHERE ( (tn.tid = '1') OR (th1.tid = '1') OR (th2.tid = '1') OR (th3.tid = '1') OR (th4.tid = '1') OR (th5.tid = '1') OR (th6.tid = '1') OR (th7.tid = '1') OR (th8.tid = '1') OR (th9.tid = '1') OR (th10.tid = '1') ))) ))) subquery
Both returns right pagination.
my problems has nothing with exposed to user setting.
I'm hope I did right this bug report.
Best regards
Przemek
Comment #11
tj2653 commentedJust to update, my original problem was solved by one of the patches in the other thread. Thanks.
Comment #12
dawehnerThe problem described in #1228280: Strange Issue with Exposed Filters is exactly which should be fixed by the subquery issue.
Thanks for reporting that it's fixed for you.
Update the status
Comment #13.0
(not verified) commentedAdded version numbers