You are here

function ds_search_apachesolr_query_alter in Display Suite 7.2

Same name and namespace in other branches
  1. 7 modules/ds_search/ds_search.module \ds_search_apachesolr_query_alter()

Implements hook_apachesolr_query_alter().

File

modules/ds_search/ds_search.module, line 676
Display Suite search.

Code

function ds_search_apachesolr_query_alter($query) {

  // Apache Solr multisite support.
  if (variable_get('ds_search_apachesolr_multisite') && variable_get('ds_search_type', 'node') == 'apachesolr_search') {

    // Site hash.
    $query
      ->addParam('fl', 'hash');

    // Rendered search result.
    $query
      ->addParam('fl', 'tm_ds_search_result');

    // Make sure this site's search results are first.
    if (variable_get('ds_search_apachesolr_multisite_boost')) {
      $hash = apachesolr_site_hash();
      $query
        ->addParam('bq', 'hash:' . $hash . '^' . variable_get('ds_search_apachesolr_multisite_boost_nr', 100));
    }
  }

  // Search per language.
  if (variable_get('ds_search_language', FALSE)) {
    global $language;
    $query
      ->addFilter('ss_language', $language->language);
  }
}