I've got a site in development where I have altered drupal's Search-Block-Form using the hook_form_alter() to include radio boxes for custom content types that I want to filter.
The search is using the ApacheSolr module, and in my hook_search_submit() I redirect to send the search critera to solr:
$form_state['redirect'] = array('search/apachesolr_search/'. trim($keys));
My problem is that before this redirect I have already run apachesolr_modify_query() and added my search parameters and filters as I need them. After the redirect is called, apachesolr_modify_query() is called a second time without the post data I need, and it overrwrites my query with what i do not want.
How do I implement a custom search_submit() using apachesolr, but without calling apachesolr_modify_query() again?
Comments
Since all the _POST data is
Since all the _POST data is cleared and the custom search box has to redirect to apachesolr I ended up storing my type flag in a session variable and then accessing it the apachesolr_modify_query().
And instead of doing a redirect I just set my submit to call a custom submit function, which directs the search back to the apachesolr_search.
Did the same thing for search_form since search_box_form and search_form call two different submit functions.
Thanks
I just wanted to say thanks for posting this! It gave me a serious bit of inspiration in solving my own problem (trying to use apachesolr_views to do numeric filtering: http://drupal.org/node/728088#comment-4116826). I hadn't considered using $_POST or $_SESSION variables, so thanks!