At the moment I am writing a module which should allow you to search inside documents attached to nodes. When you search and one of the keywords is found in the document I want the results to show the node and under the teaser a link to the attachement.
This is the problem, I can't find a way to set the Attachment: 'File' under the small teaser. This is because I can't get my hands on the $item array.
When using your own hook_search you can easily change the data by using hook_search_item($item). However to do this with the node system I just can't find a way except for in the template system.
-The hook_nodeapi(&$node, 'search result') lets you add output, however you can't put it between the teaser and the links. So after this failed I thought lets make a wrapper for node_search with my own module_search so we can combine the search results. However I am not able to not let node_search invoke.
- Another way would be to let node not register as Content and just make it invisible. This way you could make your own search 'Content Search'.
However is still think the best way would be to have a change in the core:
$extra = node_invoke_nodeapi($node, 'search result');
$results[] = array('link' => url('node/'. $item->sid, NULL, NULL, TRUE),
'type' => node_get_types('name', $node),