Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I've inherited a search form built using Views. When searching for one term the results are correct, and when searching for multiple terms enclosed in quotes the results are correct (although with duplicate entries), but when searching for multiple terms without quotes the results are not as expected.

You can view the search form at http://texasfortstrail.com. Search for fort, fort concho, and "fort concho" for different result sets.

Thoughts on what could be causing the discrepancies? I'm using Drupal 7.14 and Views 7.x-3.5.

Here's the view:

$view = new view();
$view->name = 'search_results';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Search Results';
$view->core = 7;
$view->api_version = '3.0';
$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'] = 'Search Results';
$handler->display->display_options['use_more_always'] = FALSE;
$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['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'mini';
$handler->display->display_options['pager']['options']['items_per_page'] = '25';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['style_plugin'] = 'list';
$handler->display->display_options['style_options']['wrapper_class'] = '';
$handler->display->display_options['row_plugin'] = 'fields';
$handler->display->display_options['row_options']['default_field_elements'] = FALSE;
/* 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'] = TRUE;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['fields']['title']['element_type'] = 'h3';
$handler->display->display_options['fields']['title']['element_class'] = 'title';
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['title']['element_default_classes'] = FALSE;
/* Sort criterion: Domain Access: Domain ID */
$handler->display->display_options['sorts']['gid']['id'] = 'gid';
$handler->display->display_options['sorts']['gid']['table'] = 'domain_access';
$handler->display->display_options['sorts']['gid']['field'] = 'gid';
/* Sort criterion: Search: Score */
$handler->display->display_options['sorts']['score']['id'] = 'score';
$handler->display->display_options['sorts']['score']['table'] = 'search_index';
$handler->display->display_options['sorts']['score']['field'] = 'score';
$handler->display->display_options['sorts']['score']['order'] = 'DESC';
/* Contextual filter: Search: Search Terms */
$handler->display->display_options['arguments']['keys']['id'] = 'keys';
$handler->display->display_options['arguments']['keys']['table'] = 'search_index';
$handler->display->display_options['arguments']['keys']['field'] = 'keys';
$handler->display->display_options['arguments']['keys']['default_action'] = 'empty';
$handler->display->display_options['arguments']['keys']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['keys']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['keys']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['keys']['summary_options']['items_per_page'] = '25';
/* 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'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'about_us_home' => 'about_us_home',
  'about_us_page' => 'about_us_page',
  'city' => 'city',
  'event' => 'event',
  'home_page_content' => 'home_page_content',
  'our_stories' => 'our_stories',
  'our_stories_home' => 'our_stories_home',
  'page' => 'page',
  'partners' => 'partners',
  'partners_home' => 'partners_home',
  'pya_home' => 'pya_home',
  'pya_page' => 'pya_page',
  'site' => 'site',
  'thc_theme' => 'thc_theme',
);
/* Filter criterion: Domain Access: Available on current domain */
$handler->display->display_options['filters']['current_all']['id'] = 'current_all';
$handler->display->display_options['filters']['current_all']['table'] = 'domain_access';
$handler->display->display_options['filters']['current_all']['field'] = 'current_all';

/* Display: Search Results */
$handler = $view->new_display('page', 'Search Results', 'default_results');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['defaults']['fields'] = FALSE;
/* 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']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['fields']['title']['element_type'] = 'h3';
$handler->display->display_options['fields']['title']['element_class'] = 'title';
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['title']['element_default_classes'] = FALSE;
/* Field: Content: Short Description */
$handler->display->display_options['fields']['field_desc_short']['id'] = 'field_desc_short';
$handler->display->display_options['fields']['field_desc_short']['table'] = 'field_data_field_desc_short';
$handler->display->display_options['fields']['field_desc_short']['field'] = 'field_desc_short';
$handler->display->display_options['fields']['field_desc_short']['label'] = '';
$handler->display->display_options['fields']['field_desc_short']['alter']['max_length'] = '100';
$handler->display->display_options['fields']['field_desc_short']['alter']['trim'] = TRUE;
$handler->display->display_options['fields']['field_desc_short']['element_type'] = 'p';
$handler->display->display_options['fields']['field_desc_short']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_desc_short']['element_default_classes'] = FALSE;
$handler->display->display_options['fields']['field_desc_short']['type'] = 'text_plain';
$handler->display->display_options['defaults']['sorts'] = FALSE;
/* Sort criterion: Search: Score */
$handler->display->display_options['sorts']['score']['id'] = 'score';
$handler->display->display_options['sorts']['score']['table'] = 'search_index';
$handler->display->display_options['sorts']['score']['field'] = 'score';
$handler->display->display_options['sorts']['score']['order'] = 'DESC';
$handler->display->display_options['defaults']['filter_groups'] = FALSE;
$handler->display->display_options['defaults']['filters'] = FALSE;
/* 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'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Domain Access: Available on current domain */
$handler->display->display_options['filters']['current_all']['id'] = 'current_all';
$handler->display->display_options['filters']['current_all']['table'] = 'domain_access';
$handler->display->display_options['filters']['current_all']['field'] = 'current_all';
$handler->display->display_options['filters']['current_all']['value'] = '1';
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'about_us_home' => 'about_us_home',
  'about_us_page' => 'about_us_page',
  'city' => 'city',
  'event' => 'event',
  'home_page_content' => 'home_page_content',
  'our_stories' => 'our_stories',
  'our_stories_home' => 'our_stories_home',
  'page' => 'page',
  'partners' => 'partners',
  'partners_home' => 'partners_home',
  'pya_home' => 'pya_home',
  'pya_page' => 'pya_page',
  'site' => 'site',
  'thc_theme' => 'thc_theme',
);
$handler->display->display_options['path'] = 'search/node/%';

/* Display: Other Domain Results */
$handler = $view->new_display('page', 'Other Domain Results', 'other_domain_results');
$handler->display->display_options['defaults']['title'] = FALSE;
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['defaults']['pager'] = FALSE;
$handler->display->display_options['pager']['type'] = 'mini';
$handler->display->display_options['pager']['options']['items_per_page'] = '25';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '1';
$handler->display->display_options['defaults']['fields'] = FALSE;
/* Field: Content: Link */
$handler->display->display_options['fields']['view_node']['id'] = 'view_node';
$handler->display->display_options['fields']['view_node']['table'] = 'views_entity_node';
$handler->display->display_options['fields']['view_node']['field'] = 'view_node';
$handler->display->display_options['fields']['view_node']['label'] = '';
$handler->display->display_options['fields']['view_node']['exclude'] = TRUE;
$handler->display->display_options['fields']['view_node']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['view_node']['element_default_classes'] = FALSE;
/* 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']['make_link'] = TRUE;
$handler->display->display_options['fields']['title']['alter']['path'] = '[view_node]';
$handler->display->display_options['fields']['title']['alter']['absolute'] = TRUE;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = TRUE;
$handler->display->display_options['fields']['title']['element_type'] = 'h3';
$handler->display->display_options['fields']['title']['element_class'] = 'title';
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['title']['element_default_classes'] = FALSE;
/* Field: Content: Short Description */
$handler->display->display_options['fields']['field_desc_short']['id'] = 'field_desc_short';
$handler->display->display_options['fields']['field_desc_short']['table'] = 'field_data_field_desc_short';
$handler->display->display_options['fields']['field_desc_short']['field'] = 'field_desc_short';
$handler->display->display_options['fields']['field_desc_short']['label'] = '';
$handler->display->display_options['fields']['field_desc_short']['alter']['max_length'] = '100';
$handler->display->display_options['fields']['field_desc_short']['alter']['trim'] = TRUE;
$handler->display->display_options['fields']['field_desc_short']['element_type'] = 'p';
$handler->display->display_options['fields']['field_desc_short']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_desc_short']['element_default_classes'] = FALSE;
$handler->display->display_options['fields']['field_desc_short']['type'] = 'text_plain';
$handler->display->display_options['defaults']['filter_groups'] = FALSE;
$handler->display->display_options['defaults']['filters'] = FALSE;
/* 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'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'about_us_home' => 'about_us_home',
  'about_us_page' => 'about_us_page',
  'city' => 'city',
  'event' => 'event',
  'home_page_content' => 'home_page_content',
  'our_stories' => 'our_stories',
  'our_stories_home' => 'our_stories_home',
  'page' => 'page',
  'partners' => 'partners',
  'partners_home' => 'partners_home',
  'pya_home' => 'pya_home',
  'pya_page' => 'pya_page',
  'site' => 'site',
  'thc_theme' => 'thc_theme',
);
/* Filter criterion: Domain Access: Available on current domain */
$handler->display->display_options['filters']['current_all']['id'] = 'current_all';
$handler->display->display_options['filters']['current_all']['table'] = 'domain_access';
$handler->display->display_options['filters']['current_all']['field'] = 'current_all';
$handler->display->display_options['filters']['current_all']['value'] = '0';
/* Filter criterion: Domain Access: Domain ID */
$handler->display->display_options['filters']['gid']['id'] = 'gid';
$handler->display->display_options['filters']['gid']['table'] = 'domain_access';
$handler->display->display_options['filters']['gid']['field'] = 'gid';
$handler->display->display_options['filters']['gid']['operator'] = 'not in';
$handler->display->display_options['filters']['gid']['value'] = array(
  '***CURRENT_DOMAIN***' => '***CURRENT_DOMAIN***',
  1 => '1',
);
$handler->display->display_options['path'] = 'search/node/%';
share|improve this question
    
Consider adding the results of your two example searches to this post. Otherwise once this is fixed, the URL will no longer be useful to future searchers. –  Citricguy Sep 24 '12 at 2:13
    
I have the same issue. The code shown on drupal.org/node/1950512#comment-7263844 fixed the duplicate nodes issue. –  TechNikh Apr 8 '13 at 19:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.