As it is right now, you can't define multiple search types per module, you must have a seperate module for every search type you'd like.....

hook_search:

function hook_search($op = 'search', $keys = null) {
  switch ($op) {
    case 'name':
      return t('content');
    case 'reset':
      variable_del('node_cron_last');
      return;
    case 'search':
      $find = do_search($keys, 'node', 'INNER JOIN {node} n ON n.nid = i.sid '. node_access_join_sql() .' INNER JOIN {users} u ON n.uid = u.uid', 'n.status = 1 AND '. node_access_where_sql());
      $results = array();
      foreach ($find as $item) {
        $node = node_load(array('nid' => $item));
        $extra = node_invoke_nodeapi($node, 'search result');
        $results[] = array('link' => url('node/'. $item),
                           'type' => node_invoke($node, 'node_name'),
                           'title' => $node->title,
                           'user' => theme('username', $node),
                           'date' => $node->changed,
                           'extra' => $extra,
                           'snippet' => search_excerpt($keys, check_output($node->body, $node->format)));
      }
      return $results;
  }
}

We can only declare one search type....

Comments

robertDouglass’s picture

Related issue that suggests the path and the searches available should be returned as structured data:
http://drupal.org/node/237747

jhodgdon’s picture

Version: 7.x-dev » 8.x-dev

I think this is a great idea, but it will need to wait until Drupal 8.

cpliakas’s picture

Just an FYI, I am doing work on this in my D8 sandbox at #1262140: Allow for a module to define multiple search pages and indexes. Once it is ready for a patch, I will post here.

jhodgdon’s picture

Status: Active » Closed (duplicate)

This frequently-requested feature is taken care of by
#2003482: Convert hook_search_info to plugin system