The OpenSearch module exposes search results as RSS, no need to code it yourself.
If you want a specialised form, you can just to a redirect to the OpenSearch result after processing your form.
Addendum: If you really want do do your own, you can use search_data
like this:
<?php
$data = search_data('your searchterms here');
This searches nodes (as the default second parameter for search_data
), but can also be used to search users and other things that have implemented hook_search.
Also, search_data
, belying the name, actually returns the formatted search results. If you want to have the raw search results, you can invoke hook_search
directly, or use do_search
. Examples:
<?php
$results = module_invoke('node', 'search', 'your searchterms here');
$data = do_search($query, 'node');
The difference being is that invoking the hook gives you a lot more node-related data (since it runs through the node-specific search code, in addtion to the generic do_search
(node.module's hook_search
implementation calls do_search to get the actual work done)) and a possibly more accurate search, since the node search respects the weights you might have set in the search settings. The tradeoff is a slower search query.