Hi - I know your'e busy and really don't hope i file smt wrong or repost here. But it seems the search filter doesn't work for users. On a new Drupal 6.12 installation i create a "user view", add "username" to fields and "search term" to filters and expose it with all the default options checked. I search, and nothing return.

Query:

SELECT users.uid AS uid,
   SUM(search_index.score * search_total.count) AS score,
   users.name AS users_name
 FROM users users 
 LEFT JOIN search_index search_index ON users.uid = search_index.sid
 LEFT JOIN search_total search_total ON search_index.word = search_total.word
 WHERE (search_index.word = 'simon') AND (search_index.type = 'users')
 GROUP BY search_index.sid, uid, users_name
 HAVING COUNT(*) >= 1

View:

$view = new view;
$view->name = 'user_search';
$view->description = 'user_search';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'users';
$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' => 'Name',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'link_to_user' => 1,
    'overwrite_anonymous' => 0,
    'anonymous_text' => '',
    'exclude' => 0,
    'id' => 'name',
    'table' => 'users',
    'field' => 'name',
    'relationship' => 'none',
  ),
));
$handler->override_option('filters', array(
  'keys' => array(
    'operator' => 'optional',
    'value' => '',
    'group' => '0',
    'exposed' => TRUE,
    'expose' => array(
      'use_operator' => 1,
      'operator' => 'keys_op',
      'identifier' => 'keys',
      'label' => 'Search: Search Terms',
      'optional' => 1,
      'remember' => 0,
    ),
    'id' => 'keys',
    'table' => 'search_index',
    'field' => 'keys',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('cache', array(
  'type' => 'none',
));

Comments

mstef’s picture

+1

Search returns nothing. Ran cron to make sure everything was indexed.

mstef’s picture

Can't seem to find anything in the code or interface that would cause an empty search...

?

guntherdevisch’s picture

I'm also having this problem, here's the issue: http://drupal.org/node/465158#comment-1888828

Greetz,
Gunther

dawehner’s picture

Status: Active » Closed (duplicate)

You have to enable profilesearch module to make it work, see

#574150: Remove search_index join to users table