Just a question. I'm a PHP programmer but I've never used Drupal API. I have defined a search environment with faceted search that works like a charm (great module!).

Now, I want to replace the regular search box, the one that is rendered in the templates with

print $search_form

I'm already using the keywords search block. What I want now is to make the regular search box (which is in the header, not in a block) work as a simplified keywords search box. I can make changes in the theme or implement any hook or whatever. I don't need a cross-theme or cross-installation solution.

I've tried a dirty hack and a very dirty hack, but they didn't work (problems with drupal forms, tokens and this kind of things).

Can somebody give me some example code?

Thank you very much in advance.

Comments

SlipAngel’s picture

Looking for a solution to the same problem. Found a thread in the search group looking for a similar solution as well, but the code looks like it creates a custom block, not override the default search form.

Simply knowing how to call a faceted search form via PHP would be enough. I'm sure I can handle any theming beyond that.

Countzero’s picture

I faced the same problem, and choosed to override the submit function of the default search form, setting the redirect property :

hook_form_alter :

    if ($form_id == 'search_theme_form') {
        $form['#submit'] = array('redirect_faceted');                
    }

Somewhere in the module :

function redirect_faceted($form, &$form_state) {
    $form_state['redirect'] = 'path_to_your_facet/results/'.$form_state['values']['search_theme_form'];
}

Not ideal, I guess, but efficient and seemless.

Hope it helps

chicagowebman’s picture

Looking for a solution to the same problem as well. Not sure where or how to implement the code/solution above (#2). Can someone/anyone provide more details to get this to work?

Countzero’s picture

You have to create a module of your own and put the code above in it.

http://drupal.org/node/206753