Redirect Search Block to search/apachesolr_search

Kevin Hankens - December 1, 2008 - 19:25
Project:Core searches
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

Using the drupal search block with the core searches patch uses drupal search. The block form does not specify an action, instead it redirects on submission. The only way I could get the block to submit to solr, was to alter the following function:

/**
* Process a block search form submission.
*/
function search_box_form_submit($form, &$form_state) {
  $form_id = $form['form_id']['#value'];
  $type = array_shift(search_get_implementing_modules());
  // OLD METHOD
  //$form_state['redirect'] = "search/$type/". trim($form_state['values'][$form_id]);
  // REDIRECT TO SOLR
  $form_state['redirect'] = "search/apachesolr_search/". trim($form_state['values'][$form_id]);
}

Does that make sense?

#1

kyle_mathews - February 10, 2009 - 04:53

Thanks Kevin -- I was looking for how to do this. It worked perfectly.

#2

pvasener - November 25, 2009 - 16:38

Another way is to tweak of the modules implementing the search hook as $type picks up the first one. I personally ran this query to make ApacheSolr search engine default:
UPDATE system SET weight=-10 WHERE name='apachesolr_search';

 
 

Drupal is a registered trademark of Dries Buytaert.