View displaying Taxonomy Terms from Vocabulary with at the moment 5 terms.

One of these are not supposed to be shown, so I try to use the "Taxonomy: Term ID" filter, choosing the "NOT" option and the term not to be shown.

Problem is, it times out. The "ajax preview query" times out as well as the page and block displays of the view. It doesn't matter which term I filter out, nor how many terms.

The "OR" option works fine, though.

I guess it would be easier to know what's going on if I can get the query. I tried the devel module, but it only logged queries after they'd got answered...

Comments

augustekman’s picture

Category: support » bug

I didn't manage to get this working, even setting up a separate XAMPP server with drupal having just taxonomies and views didn't make any difference.

After some more testing I found the lines of code where everything gets stuck.

Line 569-574 in includes/handlers.inc

<?php
    // Cycle through the joins. This isn't as error-safe as the normal
    // ensure_path logic. Perhaps it should be.
    $r_join = drupal_clone($join);
    while ($r_join->left_table != $base_table) {
      $r_join = views_get_table_join($r_join->left_table, $base_table);
    }
?>

I guess this is a bug, so I'm changing status.

At this moment, variables look like this:

$r_join

stdClass::__set_state(array(
   'type' => 'LEFT',
   'extra' => 
  array (
    0 => 
    array (
      'field' => 'tid',
      'value' => '3',
      'numeric' => true,
    ),
  ),
   'extra_type' => 'OR',
))

$base_table

'term_data'
jennycita’s picture

Version: 6.x-2.6 » 6.x-2.8
Component: exposed filters » taxonomy data

Marked http://drupal.org/node/749476 as a duplicate of this issue. Problem is happening with the latest version of the code and even when the filter is not exposed.

jennycita’s picture

Also marked http://drupal.org/node/645198 a duplicate of this issue.

dawehner’s picture

@jennycita
Thanks for duplicating issues!

You should not only look at the oldest issue, you should also look at the best bug reports. The other ones has export of the views.

view = new view;
$view->name = 'taxonomy_site_sections';
$view->description = 'Our site sections, a listing of taxonomy terms.';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'term_data';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
  'name' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_taxonomy' => 1,
    'exclude' => 0,
    'id' => 'name',
    'table' => 'term_data',
    'field' => 'name',
    'relationship' => 'none',
  ),
  'description' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'exclude' => 0,
    'id' => 'description',
    'table' => 'term_data',
    'field' => 'description',
    'relationship' => 'none',
  ),
));
$handler->override_option('filters', array(
  'vid' => array(
    'operator' => 'in',
    'value' => array(
      '8' => '8',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'vid',
    'table' => 'term_data',
    'field' => 'vid',
    'relationship' => 'none',
    'override' => array(
      'button' => 'Override',
    ),
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('filters', array(
  'vid' => array(
    'operator' => 'in',
    'value' => array(
      '8' => '8',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'vid',
    'table' => 'term_data',
    'field' => 'vid',
    'relationship' => 'none',
    'override' => array(
      'button' => 'Override',
    ),
  ),
  'tid' => array(
    'operator' => 'not',
    'value' => array(
      '54' => '54',
      '50' => '50',
      '53' => '53',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'type' => 'select',
    'limit' => TRUE,
    'vid' => '8',
    'id' => 'tid',
    'table' => 'term_data',
    'field' => 'tid',
    'hierarchy' => 1,
    'override' => array(
      'button' => 'Use default',
    ),
    'relationship' => 'none',
    'reduce_duplicates' => 1,
  ),
));
$handler->override_option('path', 'our-programs-quixote');
$handler->override_option('menu', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
  'name' => 'navigation',
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
));
stinky’s picture

StatusFileSize
new12.49 KB
new2.19 KB
new2.91 KB
new27.92 KB

Just wondering the status on this issue. I am using "IS NONE OF" on a CCK Taxonomy Field (see Snap1.gif), and instead of running the query as "IS NONE OF", it's running the query as "IS ALL OF" (Snap2.gif and sql-query.txt).

iamjon’s picture

Status: Active » Postponed (maintainer needs more info)

as this issue has been combined with several others, can someone who is following this thread please update if this has been addressed. if not please provide instructions on how to duplicate using basic content types and an export.

@stinky, thank you for the information unfortunately it's un relatated to this specific issue, please open a new issue explaining what is happening and what you want to achieve.

marking this as postponed

iamjon’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

I'm marking this as closed. Please feel free to reopen with more information.

richsky’s picture

Status: Closed (cannot reproduce) » Active

Hi there,

Having the same issue here. When setting say a new display for taxonomy terms, with an argument, your results as field, using terms and node nid (I wanted the term to link to it's node):

term_data.vid AS term_data_vid,
term_data.tid AS term_data_tid
 FROM node node 
 LEFT JOIN term_node term_node ON node.vid = term_node.vid 
 AND (term_node.tid = 1057 OR term_node.tid = 1063) ----> this is wrong!!!
 LEFT JOIN term_data term_data ON term_node.tid = term_data.tid
 LEFT JOIN term_hierarchy term_hierarchy ON term_data.tid = term_hierarchy.tid
 WHERE 
 (term_node.tid IS NULL) ----> this is wrong!!!
  AND (node.type in ('ilr')) AND (node.status <> 0 OR (node.uid = ***CURRENT_USER*** AND ***CURRENT_USER*** <> 0) OR ***ADMINISTER_NODES*** = 1) AND (term_hierarchy.parent IN (257, 331))
   ORDER BY term_data_name ASC

Shouldn't we have something like:

SELECT node.nid AS nid,
term_data.name AS term_data_name,
term_data.vid AS term_data_vid,
term_data.tid AS term_data_tid
 FROM node node 
 INNER JOIN term_node term_node ON node.vid = term_node.vid
 LEFT JOIN term_data term_data ON term_node.tid = term_data.tid
 LEFT JOIN term_hierarchy term_hierarchy ON term_data.tid = term_hierarchy.tid
 WHERE 
 (term_node.tid NOT (1057, 1063)) -------> Is this better?
  AND (node.type in ('ilr')) AND (node.status <> 0 OR (node.uid = ***CURRENT_USER*** AND ***CURRENT_USER*** <> 0) OR ***ADMINISTER_NODES*** = 1) AND (term_hierarchy.parent IN (257, 331))
   ORDER BY term_data_name ASC

Hope this help.

tommeir’s picture

this solution doesnt work for me.(in my case i only have 1 term inside that vocab).

using content taxonomy instead and thus shifting the filter handling problem to cck seems to do it.

couturier’s picture

Status: Active » Closed (won't fix)

Most people are working in Drupal 7 now, and Drupal 8 is less than a year from release.