I just upgraded to 7.x-3.x-dev from a previous version. I had some views with exposed filters to filter by taxonomy term.
After I upgraded, when I tried to filter by a term the following mysql error occurred:
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIKE 'Term Name' ESCAPE '\\') ))) subquery' at line 1: SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression FROM {node} node WHERE (( (node.status = :db_condition_placeholder_0) AND (node.type IN (:db_condition_placeholder_1)) AND (.name LIKE :db_condition_placeholder_2 ESCAPE '\\') ))) subquery; Array ( [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] => content_type [:db_condition_placeholder_2] => Term Name ) in views_plugin_pager->execute_count_query() (line 140 of /Applications/MAMP/htdocs/project/code/sites/all/modules/views/plugins/views_plugin_pager.inc).
In addition, if I remove that filter and try to re-add it, it not longer allows to filter by any taxonomy criteria. Just nothing there. I've attached a screenshot as evidence.
Comments
Comment #1
dawehnerThe taxonomy integration was rewritten.
To be able to filter for taxonomy terms you have to add the relationship " Content: Taxonomy terms on node".
Once you did this you get all the filters back.
Comment #2
anavarre@dereine I had the same issue and your answer was very helpful, thank you. Nevertheless, I have a simple question for you about all this : why would you do that ?
Before you only had to do a single (easy) operation, now you have to be an advanced user or at least to understand the relationship mechanism which is quite the opposite of redesigning the Views UI so that it's easier to use.
I guess it has something to do with node reference and/or entity and/or the ability to have a further use of taxonomy relations with nodes, like description, image etc...well, powerful features.
Would you please tell me more ?
Comment #3
dawehnermerlinofchaos rewrite the taxonomy integration, because it was hell confusing, too with fieldapi in the background.
Additional in general, from what i think, explicit actions are better.
So for example all user/comment fields shouldn't be there by default, too. The problem is that the user don't think about for view type(user/node/taxonomy term). If relationships are forced use will think more about it. That's my oppinion.
Comment #4
merlinofchaos commentedTo clarify for dereine:
The problem with taxonomy is that once it was rewritten as a field API field, there were too many different ways to do things. The single 'easy' operations can have really nasty side effects that you may not want. In very simple situations you might not see them, so it's difficult to know they're there.
So yes, I realize we've made some parts of taxonomy a little more difficult. That said, what you're doing in particular has several interesting side effects if you have, say, the same term name in multiple vocabularies. Without the relationships, you have absolutely no way to deal with that.
IMO, one of the problems with Views is that early on I made several relationships (taxonomy and users, in particular) implicit and that made a few things "easier" but it also obscured the reality that if you don't understand these relationships, you're prevented from doing a great deal of stuff, OR you have to deal with the side effects of these implicit relationships when you shouldn't.
Comment #5
anavarre@merlinofchaos Crystal clear, thank you. I guessed it had something to do with being able to clean up the code and doing great stuff in the end. This brings me to your call for contributors, if we want to help - let's say rewrite the documentation - we have to figure what the changes are when they occur. I'm discovering them when I have an issue (maybe I missed something in the release notes or on a blog post) and Drupal's Building Blocks will help less and less as the code changes.
Maybe you have a thought about that ?
Comment #6
davegan commentedyeah, the particular issue is that this breaks the views already built without any explanation. I certainly would have looked under relationships if I was building my views from scratch.
what's the best way to notify upgrading users that they need to rebuild their views?