You are here

function hook_search_api_solr_query_alter in Search API Solr 7

Same name and namespace in other branches
  1. 8.3 search_api_solr.api.php \hook_search_api_solr_query_alter()
  2. 8 search_api_solr.api.php \hook_search_api_solr_query_alter()
  3. 8.2 search_api_solr.api.php \hook_search_api_solr_query_alter()
  4. 4.x search_api_solr.api.php \hook_search_api_solr_query_alter()

Lets modules alter a Solr search request before sending it.

Apache_Solr_Service::search() is called afterwards with these parameters. Please see this method for details on what should be altered where and what is set afterwards.

Parameters

array $call_args: An associative array containing all three arguments to the SearchApiSolrConnectionInterface::search() call ("query", "params" and "method") as references.

SearchApiQueryInterface $query: The SearchApiQueryInterface object representing the executed search query.

2 invocations of hook_search_api_solr_query_alter()
SearchApiSolrService::getAutocompleteSuggestions in includes/service.inc
SearchApiSolrService::search in includes/service.inc
Executes a search on the server represented by this object.

File

./search_api_solr.api.php, line 27
Hooks provided by the Search API Solr search module.

Code

function hook_search_api_solr_query_alter(array &$call_args, SearchApiQueryInterface $query) {
  if ($query
    ->getOption('foobar')) {
    $call_args['params']['foo'] = 'bar';
  }
}