Index: includes/views/handlers/content_plugin_display_simple.inc =================================================================== --- includes/views/handlers/content_plugin_display_simple.inc (revision 190) +++ includes/views/handlers/content_plugin_display_simple.inc (working copy) @@ -19,20 +19,24 @@ function query() { $options = $this->get_option('content_options'); - if ($options['string'] !== '') { - $match_clauses = array( - 'contains' => "LIKE '%%%s%%'", - 'equals' => "= '%s'", - 'starts_with' => "LIKE '%s%%'", - ); - $clause = isset($match_clauses[$options['match']]) ? $match_clauses[$options['match']] : $match_clauses['contains']; - $alias = $this->view->query->ensure_table($options['table']); - $this->view->query->add_where(NULL, "$alias.$options[field_string] $clause", $options['string']); + foreach ($options as $option) { + if ($option['string'] !== '') { + $match_clauses = array( + 'contains' => "LIKE '%%%s%%'", + 'equals' => "= '%s'", + 'starts_with' => "LIKE '%s%%'", + ); + $clause = isset($match_clauses[$option['match']]) ? $match_clauses[$option['match']] : $match_clauses['contains']; + $alias = $this->view->query->ensure_table($option['table']); + $this->view->query->add_where('cck', "$alias.$option[field_string] $clause", $option['string']); + $this->view->query->set_where_group('OR', 'cck'); + } + elseif ($option['ids']) { + $alias = $this->view->query->ensure_table($option['table']); + $this->view->query->add_where('cck', "$alias.$option[field_id] IN (" . db_placeholders($option['ids']) . ')', $option['ids']); + $this->view->query->set_where_group('OR', 'cck'); + } } - elseif ($options['ids']) { - $alias = $this->view->query->ensure_table($options['table']); - $this->view->query->add_where(NULL, "$alias.$options[field_id] IN (" . db_placeholders($options['ids']) . ')', $options['ids']); - } } } Index: modules/nodereference/nodereference.module =================================================================== --- modules/nodereference/nodereference.module (revision 201) +++ modules/nodereference/nodereference.module (working copy) @@ -762,6 +762,7 @@ $display = $view->add_display('content_references'); $view->set_display($display); + // TODO from merlinofchaos on IRC : arguments using summary view can defeat the style setting. // We might also need to check if there's an argument, and set *its* style_plugin as well. $view->display_handler->set_option('style_plugin', 'content_php_array_autocomplete'); @@ -772,14 +773,29 @@ // Additional options to let content_plugin_display_references::query() // narrow the results. - $options = array( - 'table' => 'node', - 'field_string' => 'title', - 'string' => $string, - 'match' => $match, - 'field_id' => 'nid', - 'ids' => $ids, - ); + if (is_array($fields = $view->display_handler->get_option('fields'))) { + foreach ($fields as $field) { + $options[] = array( + 'table' => $field['table'], + 'field_string' => $field['field'], + 'string' => $string, + 'match' => $match, + 'field_id' => $field['id'], + 'ids' => $ids, + 'extra_type' => 'OR', + ); + } + } else { + $options[] = array( + 'table' => 'node', + 'field_string' => 'title', + 'string' => $string, + 'match' => $match, + 'field_id' => 'nid', + 'ids' => $ids, + ); + $view->add_item($display, 'field', 'node', 'title'); + } $view->display_handler->set_option('content_options', $options); // TODO : for consistency, a fair amount of what's below @@ -799,12 +815,6 @@ $view_args = array(); } - // We do need title field, so add it if not present (unlikely, but...) - $fields = $view->get_items('field', $display); - if (!isset($fields['title'])) { - $view->add_item($display, 'field', 'node', 'title'); - } - // If not set, make all fields inline and define a separator. $options = $view->display_handler->get_option('row_options'); if (empty($options['inline'])) {