How To Get Full Text From RSS?

Drupal node_seach

  • I'm working on a RSS feed where full text search has to be offered - you search from some box, and get the result as a RSS. I've been trying to get node_search and do_search working but I'm missing something... but what? As far as I can tell, something like $find = node_search('search', 'type:article'); should give me a result containing all matching nodes where the type = 'article'. But how do I specify the keyword/search term? What am I missing?

  • Answer:

    The http://drupal.org/project/opensearch 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 http://api.drupal.org/api/function/search%5Fdata/6 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 http://api.drupal.org/api/function/module%5Finvoke/6 http://api.drupal.org/api/function/hook%5Fsearch/6 directly, or use http://api.drupal.org/api/function/do%5Fsearch/6. 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.

kristian nissen at Stack Overflow Visit the source

Was this solution helpful to you?

Other answers

It should jsut be key:value you can use - and "" also. http://api.drupal.org/api/function/hook%5Fsearch/6 Phil

Phil Carter

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.