Apache Solr als Standardsuche

Zur Zeit ist es nicht möglich, apache solr als Standardsuche zu definieren. Aus diesem Grund habe ich ein kleines Modul geschrieben, dass auf allen Suchformularen Apache Solr als Standardsuche definiert. Anbei das Module und der Code.

Download Apache Solr Default Search Module

Ich verwende dieses Modul auch auf dieser Seite.

 

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]);
}&nbsp;

Download Apache Solr Default Search Module