1.

How To Interact With Drupal Search System ?

Answer»

There are THREE ways to interact with the search system: Specifically for searching nodes, you can implement nodeapi(‘UPDATE index’) and nodeapi(‘search result’). However, note that the search system already indexes all visible output of a node, i.e. everything displayed normally by hook_view() and hook_nodeapi(‘view’). This is usually sufficient. You should only use this mechanism if you want additional, non-visible data to be indexed.

Implement hook_search(). This will create a search tab for your module on the /search page with a simple keyword search form. You may optionally implement hook_search_item() to customize the display of your results.

Implement hook_update_index(). This allows your module to use Drupal’s HTML indexing mechanism for searching full text efficiently.

If your module needs to provide a more COMPLICATED search form, then you need to implement it yourself without hook_search(). In that case, you should define it as a local TASK (tab) under the /search page so that USERS can easily find it.

There are three ways to interact with the search system: Specifically for searching nodes, you can implement nodeapi(‘update index’) and nodeapi(‘search result’). However, note that the search system already indexes all visible output of a node, i.e. everything displayed normally by hook_view() and hook_nodeapi(‘view’). This is usually sufficient. You should only use this mechanism if you want additional, non-visible data to be indexed.

Implement hook_search(). This will create a search tab for your module on the /search page with a simple keyword search form. You may optionally implement hook_search_item() to customize the display of your results.

Implement hook_update_index(). This allows your module to use Drupal’s HTML indexing mechanism for searching full text efficiently.

If your module needs to provide a more complicated search form, then you need to implement it yourself without hook_search(). In that case, you should define it as a local task (tab) under the /search page so that users can easily find it.



Discussion

No Comment Found