hook_search

Events happening in the community are now at Drupal community events on www.drupal.org.
mihksoft's picture

Hy!
I have a table author with author_id, author_first_name, author_last_name, author_date_of_birth, author_date_of_death, author_website, author_email, author_language_id, author_isDeleted.
I have make a module author, implement the hook_menu and make a table view for my table and a modify form. From the content I have make a new content type called Author. I have implement the hook_search in my module

function author_search($op = 'search', $keys = null)
{
switch ($op)
{
case 'name':
return t('Content');
case 'search':
$find = array();
// Replace wildcards with MySQL/PostgreSQL wildcards.
$keys = preg_replace('!*+!', '%', $keys);

        // Administrators can also search in the otherwise private email field.
        $result = pager_query("SELECT * FROM {cb_author} WHERE LOWER(author_first_name) LIKE LOWER('%%%s%%')", 15, 0, NULL, $keys, $keys);
        while ($account = db_fetch_object($result))
        {
            $find[] = array('title' => $account->author_first_name, 'link' => url('admin/cookbook/author/edit/'. $account->author_id, array('absolute' => TRUE)));
        }

        return $find;
}

}

The problem is that I want the result of my search to be in the same page with the search module path. For example: I want to make a search and the result to display in the same page with the search not in another tab menu. And I want to redirect the search result to a path, how can I do that?

Thanks for any help!

Comments

Currently you cannot easily

BlakeLucchesi's picture

Currently you cannot easily allow the search module to include other content with the generic search. If you look at node.module's implementation of hook_search you will see that all of the code that handles the normal content search is there. Sorry.

Blake

youlikeicecream's picture

Can anyone help ? I have implemented hook_search, but the search tabs disappear when I enter a search term.

What am I missing ?

thanks in advance
Mike

Search

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: