You are here

function acquia_search_search_api_solr_query_alter in Acquia Search 3.x

Implements hook_search_api_solr_query_alter().

File

./acquia_search.module, line 228
Integration between Drupal and Acquia's hosted Solr search service.

Code

function acquia_search_search_api_solr_query_alter(SolariumQueryInterface $solarium_query, QueryInterface $query) {
  $handler = $solarium_query
    ->getHandler();
  $search_index = $query
    ->getIndex();
  try {
    $server = $search_index
      ->getServerInstance();
  } catch (SearchApiException $exception) {
    return;
  }
  if (empty($server)) {
    return;
  }
  if (!Runtime::isAcquiaServer($server)) {
    return;
  }
  if ('select' === $handler) {
    $use_edismax = $search_index
      ->getThirdPartySetting('acquia_search', 'use_edismax', TRUE);
    if ($use_edismax) {
      $solarium_query
        ->addParam('defType', 'edismax');
    }
  }
}