3

I am using Apache Solr on my website and the search form block is configured to use Apache Solr. I also use the Apache Solr panels module to panelize my page.

I create a panel on search/my-search/!query, when I use it manually all works fine but when I search via the form search block, I am redirected on the default Apache Solr result page (search/site/!query).

How can I change this behavior ?

EDIT : Okay, I found the solution by searching a little bit more !

I just disabled the default search block form and put the "Search form (Apache Solr Panels)" in the section I wanted. I only have to restyling my input.

I will put it in a separate answer tomorrow (because of my reputation, I can't answer in the next 8hrs after posting my question)

2 Answers 2

1

use

function hook_form_alter(&$form, &$form_state, $form_id) {
  if($form_id == "search_block_form") {
    $form['#submit'] = array('custom_search_redirect');
  }
}

function custom_search_redirect($form, &$form_state) {
  $search_data = $form_state['values']['search_block_form'];
  $form_state['redirect'] = "search/my-search".$search_data;
}
0

Sorry for delay, I post here my answer separately from the question :

Okay, I found the solution by searching a little bit more !

I just disabled the default search block form and put the "Search form (Apache Solr Panels)" in the section I wanted. I only have to restyling my input.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.