Hi,

I am trying to create a view that allows users to filter nodes based on three different taxonomies (topics, countries and project status). The Countries and the Project Status filters use the built-in Has taxonomy term exposed filter, while the Topics filter uses an exposed Has taxonomy term (reference filter).

When selecting any value for the Topics filter, the view generates the following SQL code:

SELECT DISTINCT node.nid AS nid, node.title AS node_title, ...
{node} node
LEFT JOIN {taxonomy_index} taxonomy_index ON node.nid = taxonomy_index.nid
...
WHERE ... taxonomy_index.tid IN  ('3158') AND (taxonomy_index.tid = '4275'

Of course, the above condition can never be true, so the view does not return any results. The same view generates the following WHERE clause when using the built-in Has taxonomy term filter:

SELECT DISTINCT node.nid AS nid, node.title AS node_title, ...
{node} node
INNER JOIN {taxonomy_index} taxonomy_index ON node.nid = taxonomy_index.nid
LEFT JOIN {taxonomy_index} taxonomy_index2 ON node.nid = taxonomy_index2.nid AND taxonomy_index2.tid != '3158'
...
WHERE ... (taxonomy_index.tid = '3158') AND (taxonomy_index2.tid = '4275') 

The built-in filter module is somehow smarter in creating two joins, of which one is conditional. This makes it possible to filter content based on different taxonomy_index criteria.

Any way of fixing this?

PS: I am using Views 7.x-3.18.

Comments

velimir_alic created an issue. See original summary.

velimir_alic’s picture

Version: 7.x-1.5 » 7.x-1.7