Needs review
Project:
Views (for Drupal 7)
Version:
7.x-3.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
12 Jan 2011 at 22:11 UTC
Updated:
20 Apr 2019 at 13:17 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
alex_b commentedThis patch should fix the issue. Compare the times of these two queries, the first one without the patch applied, the second one with the patch applied:
http://skitch.com/alexbarth/rjb21/home-performance.reliefweb.devseed.com
http://skitch.com/alexbarth/rjb2x/home-performance.reliefweb.devseed.com
Comment #2
dawehnerMh skitch is kind of broken for german ISP's, at least i had the problem many times already.
Anyway.
Regarding this code:
Shouldn't this be caught already by the join type? INNER vs LEFT.
Comment #3
alex_b commentedDo you refer to the code in the if clause (
set_where_group(OR), add_where(NULL))? If we add a WHERE clause to a branch that's LEFT JOINed, it starts to behave like an INNER JOIN - hence the OR NULL clause.Comment #4
merlinofchaos commentedI don't sufficiently understand D7 taxonomy to be able to review this.
Comment #5
merlinofchaos commentedNow that I better understand D7 taxonomy, there's no way this patch can work. The whole reason for the subselect is that the condition is two joins away. You can't add the join conditionally in the non-required case and still have it work.
The WHERE doesn't work because you can then end up getting terms that are outside the specified vocabularies because they end up looking like NULLs.
I'll spend a few minutes testing this to be sure, but I'm pretty confident this construct doesn't work. I spent quite a bit of time with David Strauss trying to figure out the query that will work in this case.
Now, with D7, if you only care about a single vocabulary, which is the majority case, we *can* add a relationship on the field itself, which *does* know about vocabulary and that will work. So I do want to go that route.
Comment #6
merlinofchaos commentedOkay, that relationship already exists. Yay!
I did some testing of this patch. It doesn't fail in the way I thought, but the IS NULL check simply doesn't work.
I tried fiddling with it a little, but I couldn't make it work.
Scenario:
Create a view to list titles of a particular node type.
Set up a relationship specifying vocabularies that that node type cannot have. Make it not required.
Pre-patch: You get a simple list of nodes.
Post-patch: You get no results.
Comment #7
dawehnerUnassign myself because the patch is already reviewed
Comment #8
makara commentedHere we have 3 different situations I think.
1) No vocabulary supplied.
2) One or more vocabularies supplied and it is required.
3) One or more vocabularies supplied and it is not required.
For the first, we can have a simple join. For the third, we need the sub-query because we don't want to select terms from other vocabularies. For the second, I think we can just use the inner join.
Patch attached.
And I think there's another bug here. Please see the lines 18 and 19 in the patch. The relationship need to join to the added index table. Otherwise multiple relationships will use a same index table.
Comment #9
makara commentedPatch updated.
An "ensure_table" with a custom join can generate duplicate joins with other "ensure_table"s. So I moved the join conditions to "where".
I also took back "$join->adjusted = TRUE;". But I don't know why it's there :P.
Comment #10
tim.plunkettTriggering the testbot.
Comment #11
dawehnerPuh it would be good to have an issue summary here, as this is not that easy to understand.
Comment #12
k.skarlatos commentedHello, is this issue still alive? does this patch work on current views version?
Comment #13
ivansf commentedI would like to know that too. I'm stil having the same problem with version 3.7
Comment #14
chris matthews commentedThe 7 year old patch in #9 to views_handler_relationship_node_term_data.inc does not apply to the latest views 7.x-3.x-dev and if still applicable needs reroll.
Comment #15
andrew answer commentedPatch rerolled.