Posted by nedjo on July 14, 2008 at 12:57pm
I've posted a first cut at a patch to refactor core search into a generic search module that accepts different backend handlers and a specific handler, core's custom indexing. It's a very basic patch--it just does the minimum to decouple the generic search interface from the backend.
The aim is to permit e.g. apachesolr and other search backends to plug in seamlessly to core search.
Ready for review: http://drupal.org/node/282192.
Comments
Both the coresearches module
Both the coresearches module and Nedjo's patch removes almost identical functions from the user and node modules. The coresearches modules moves the node functions into the contentsearch module and the user functions into the usersearch module, whereas Nedjo's patch moves the functions into .inc files that remain with their respective node and user modules, but only get executed when the sql_search module is enabled.
Also Nedjo's patch adds handlers to the search modules, removes the sql bits from the search module, and moves it into the sql_search module.
Coresearches module
removes from node.module
- node_search($op, $keys) ... adds contentsearch_search($op, $keys)
- theme_node_search_admin($form) ... adds theme_contentsearch_search_admin($form)
- node_update_index() ... adds contentsearch_update_index()
- _node_index_node($node) ... adds contentsearch_index_node($node)
- node_form_alter(&$form, $form_state, $form_id) ... adds contentsearch_form_alter(&$form, &$form_state, $form_id)
- node_search_validate($form, &$form_state) ... adds contentsearch_search_validate
removed from user.module
- user_search($op, $keys, $skip_access_check)
Nedjo's patch
removes from node.module
- node_search ... adds node_sql_search
- node_update_index ... adds _node_index()
- _node_index_node
- node_form_alter ... adds sql_search_form_search_form_alter
- node_search_validate ... adds node_advanced_search_validate
removes from search.admin.inc
- search_wipe_confirm()
- search_wipe_confirm_submit()
removes search.install ... adds sql_search.install
removes from search.module
- _search_menu()
- search_wipe()
- search_dirty()
- search_cron()
- search_update_totals()
- search_simplify()
- search_exand_cjk()
- search_index_split()
- _search_index_truncate()
- search_index()
- search_touch_node()
- search_nodeapi()
- search_comment()
- _search_parse_query()
- do_search()
Adding to search.module
- search_handlers()
- search_types()
- search_active_handler()
- _search_default_handler()
- search_invoke_handler()
Removes from user.module
- user_search() ... but adds user_sql_search()
Very interesting!
Thanks Nedjo for getting the ball rolling here. I have to digest the idea of handlers, but on first blush it seems like an improvement.