Apache Solr as the default search

At the moment, it is not possible to set apache_solr as the default search.

How to activate Apache Solr as the default Search?

Any easy way to activate apachesolr on all search forms as the default search, is to download and install the module I created for this reason:

Download Apache Solr Default Search Module

I also use this module on my page. 

Code:

<?php
// $Id$

/**
 * @file
 * ApacheSolr as the default search engine by ayalon GmbH (www.ayalon.ch)
 *
 */

/**
* Implementation of hook_form_alter().
*/
function apachesolr_default_form_alter(&$form, $form_state, $form_id) {
  $search_forms = array('search_block_form', 'search_theme_form');
  if (in_array($form_id, $search_forms)) {
    $form['#submit'] = array('ayalon_search_submit');
  }
}

/**
* Custom form submit handler for the search block.
*/
function apachesolr_default_search_submit($form, &$form_state) {
  $form_id = $form['form_id']['#value'];
  $form_state['redirect'] = "search/apachesolr_search/". trim($form_state['values'][$form_id]);
} 

Download Apache Solr Default Search Module


Jonathan, many thanks for

Jonathan, many thanks for making this available.
However, the link provided for download does not work for me.
Can this be fixed?

Hi Jonathan, Your module to

Hi Jonathan,
Your module to make Apache Solr the default search on Drupal would be very useful for me but your link doesnt seem to work? Any reason?
Thanks
Glen

It's was fixed a while ago.

It's was fixed a while ago.

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen