Hi,

I'm using Views 3 on Drupal 7 and i'm trying to create a block to show nodes tagged with 'download' from 2 separate vocab i have setup.

Adding only one to the views filter works but when trying to add another one, it produces no results.

This is what i have:

Filter criteria
---------------
Content: Has taxonomy term (= download) {this one is filtering on blog tag vocab}
Content: Has taxonomy term (= download) {this one is filtering on tutorials tag vocab}

If i have only one in the filter, it works but not both. Perhaps, i'm not using the filter correctly?

Here's my exported views:

$view = new view;
$view->name = 'download_block';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Download block';
$view->core = 7;
$view->api_version = '3.0-alpha1';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Downloads';
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['distinct'] = TRUE;
$handler->display->display_options['query']['options']['query_comment'] = FALSE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'some';
$handler->display->display_options['pager']['options']['items_per_page'] = '5';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'list';
$handler->display->display_options['row_plugin'] = 'fields';
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['link_to_node'] = 1;
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 0;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Has taxonomy term */
$handler->display->display_options['filters']['tid']['id'] = 'tid';
$handler->display->display_options['filters']['tid']['table'] = 'taxonomy_index';
$handler->display->display_options['filters']['tid']['field'] = 'tid';
$handler->display->display_options['filters']['tid']['value'] = array(
  208 => '208',
);
$handler->display->display_options['filters']['tid']['reduce_duplicates'] = 0;
$handler->display->display_options['filters']['tid']['type'] = 'select';
$handler->display->display_options['filters']['tid']['vocabulary'] = 'tags';
$handler->display->display_options['filters']['tid']['hierarchy'] = 1;
/* Filter criterion: Content: Has taxonomy term */
$handler->display->display_options['filters']['tid_1']['id'] = 'tid_1';
$handler->display->display_options['filters']['tid_1']['table'] = 'taxonomy_index';
$handler->display->display_options['filters']['tid_1']['field'] = 'tid';
$handler->display->display_options['filters']['tid_1']['value'] = array(
  214 => '214',
);
$handler->display->display_options['filters']['tid_1']['reduce_duplicates'] = 0;
$handler->display->display_options['filters']['tid_1']['type'] = 'select';
$handler->display->display_options['filters']['tid_1']['vocabulary'] = 'tutorials_tags';
$handler->display->display_options['filters']['tid_1']['hierarchy'] = 1;

/* Display: Block */
$handler = $view->new_display('block', 'Block', 'block');

thanks,

Comments

dawehner’s picture

Can you show the generated sql? It general this should work from my perspective.

onejam’s picture

Sorry i can't reproduce this issue again as i've changed the structure of the vocab but thanks for looking into it, much appreciated.

dawehner’s picture

Status: Active » Fixed

Okay update status.

tj2653’s picture

duvien - I know you changed your vocab structure, but it seems like your issue might have been similar to mine: http://drupal.org/node/1228280

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Jason Dean’s picture

Version: 7.x-3.0-rc1 » 7.x-3.x-dev
Status: Closed (fixed) » Active

Hi

I have the same issue as originally posted, using latest dev. My filter criteria looks like this:

Content: Published (Yes)
Content: Type (= Film)
Content: Has taxonomy term (= Festival) {filtering on 'type' vocabulary}
Content: Has taxonomy term (= 2011) {filtering on 'year' vocabulary}

This returns no results. If I remove one of the taxonomy term filters, results show fine.

Interestingly if I use filter 'Has taxonomy terms (with depth)' instead, the view works fine even when I use it twice. So problem seems to be to do with 'Has taxonomy term' filter?

Here's the SQL query:

SELECT node.title AS node_title, node.nid AS nid, 'node' AS field_data_field_year_node_entity_type, 'node' AS field_data_field_tag_node_entity_type
FROM 
{node} node
INNER JOIN (SELECT td.*, tn.nid AS nid
FROM 
{taxonomy_term_data} td
INNER JOIN {taxonomy_vocabulary} tv ON td.vid = tv.vid
INNER JOIN {taxonomy_index} tn ON tn.tid = td.tid
WHERE  (tv.machine_name IN  ('76')) ) taxonomy_term_data_node ON node.nid = taxonomy_term_data_node.nid
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 != '98'
WHERE (( (node.status = '1') AND (node.type IN  ('film')) AND (taxonomy_index.tid = '98') AND (taxonomy_index2.tid = '76') ))
ORDER BY node_title DESC
LIMIT 10 OFFSET 0

Thanks

kars-t’s picture

Status: Active » Fixed

Hi

I am closing this issue to clean up the issue queue. Feel free to reopen the issue if there is new information and the problem still resides. If not please make sure you close your issues that you don't need any more.

Maybe you can get support from the local user group. Please take a look at this list at groups.drupal.org.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jtwalters’s picture

I know this is a really old thread, but I had the same issue and tried out the "Reduce Duplicates" option and that seemed to resolve the issue.