after upgrade I notice that my view is not working right
I use Search Terms filter.
When I search for "philips" or "444" i find node named "philips 444", but when i search "philips 444" i find nothing.
views 2.2 and 2.3 make different queries (see GROUP BY section)
2.2:
SELECT node.nid AS nid, SUM(search_index.score * search_total.count) AS score, node.vid AS node_vid, node.type AS node_type, node.title AS node_title FROM node node LEFT 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 search_index search_index ON node.nid = search_index.sid LEFT JOIN search_total search_total ON search_index.word = search_total.word WHERE (term_data.vid in ('1')) AND (search_index.word = 'philips' OR search_index.word = '444') AND (search_index.type = 'node') GROUP BY search_index.sid HAVING COUNT(*) >= 2
2.3:
SELECT node.nid AS nid, SUM(search_index.score * search_total.count) AS score, node.vid AS node_vid, node.type AS node_type, node.title AS node_title FROM node node LEFT 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 search_index search_index ON node.nid = search_index.sid LEFT JOIN search_total search_total ON search_index.word = search_total.word WHERE (term_data.vid in ('1')) AND (search_index.word = 'philips' OR search_index.word = '444') AND (search_index.type = 'node') GROUP BY search_index.sid, nid, score, node_vid, node_type, node_title HAVING COUNT(*) >= 2
view code
$view = new view;
$view->name = 'search4review';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$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(
'field_product_images_fid' => array(
'label' => '',
'link_to_node' => 0,
'label_type' => 'none',
'format' => '30x30_default',
'multiple' => array(
'group' => 1,
'multiple_number' => '1',
'multiple_from' => '0',
'multiple_reversed' => 0,
),
'exclude' => 0,
'id' => 'field_product_images_fid',
'table' => 'node_data_field_product_images',
'field' => 'field_product_images_fid',
'relationship' => 'none',
),
'title' => array(
'label' => '',
'link_to_node' => 0,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
),
));
$handler->override_option('filters', array(
'vid' => array(
'operator' => 'in',
'value' => array(
'1' => '1',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'vid',
'table' => 'term_data',
'field' => 'vid',
'relationship' => 'none',
),
'keys' => array(
'operator' => 'required',
'value' => '',
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'keys_op',
'identifier' => 'keys',
'label' => 'Поиск',
'optional' => 0,
'remember' => 0,
),
'id' => 'keys',
'table' => 'search_index',
'field' => 'keys',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('header', 'some text... ');
$handler->override_option('header_format', '1');
$handler->override_option('header_empty', 1);
$handler->override_option('footer', 'some text...');
$handler->override_option('footer_format', '2');
$handler->override_option('footer_empty', 1);
$handler->override_option('empty_format', '1');
$handler->override_option('use_ajax', TRUE);
$handler->override_option('use_pager', '1');
$handler->override_option('style_options', array(
'grouping' => '',
));
$handler->override_option('row_options', array(
'inline' => array(
'field_product_images_fid' => 'field_product_images_fid',
'title' => 'title',
),
'separator' => '',
));
Comments
Comment #1
merlinofchaos commentedWhat version of mysql are you using?
Comment #2
merlinofchaos commentedWhat version of MySQL are you running? That variant of the query is working for me.
Comment #3
merlinofchaos commentedThis is the same as http://drupal.org/node/373760 -- let's continue discussion there.