I need to modify the search results drupal generates to include selected content from some other D6 sister sites. hook_search
seemed like the obvious choice, but when I implement it, it's never invoked with the keywords I'm searching for:
function nmc_xsearch_search( $op = 'search', $keys = NULL ) {
switch ($op) {
case 'name':
return t('Content');
return $form;
case 'search':
dsm( "Operation: $op | Keys: $keys" );
return $results;
}
}
When I walk through this code in the debugger, my function nmc_xsearch_search() is hit twice. The first time $op = 'name' and $keys = null. The second time $op = 'name' and $keys = '1'.
When I put a breakpoint on node_search
it is invoked four times - all before my nmc_xsearch_search() is hit. The last time node_search is hit the provided parameters are: $op = 'search' and $keys = 'my search keywords'.
Basically I want my function to get the same invocation that node_search
is getting so that I can access the keywords and modify the results array returned by hook_search. Any ideas?