You are here

function hook_search_api_solr_search_results_alter in Search API Solr 8.3

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

Lets modules alter the search results returned from a Solr search.

Parameters

\Drupal\search_api\Query\ResultSetInterface $result_set: The results array that will be returned for the search.

\Drupal\search_api\Query\QueryInterface $query: The SearchApiQueryInterface object representing the executed search query.

\Solarium\QueryType\Select\Result\Result $result: The Solarium result object.

1 function implements hook_search_api_solr_search_results_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

search_api_solr_devel_search_api_solr_search_results_alter in modules/search_api_solr_devel/search_api_solr_devel.module
Implements hook_search_api_solr_search_results_alter().
1 invocation of hook_search_api_solr_search_results_alter()
SearchApiSolrBackend::search in src/Plugin/search_api/backend/SearchApiSolrBackend.php
Options on $query prefixed by 'solr_param_' will be passed natively to Solr as query parameter without the prefix. For example you can set the "Minimum Should Match" parameter 'mm' to '75%' like this:

File

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

Code

function hook_search_api_solr_search_results_alter(\Drupal\search_api\Query\ResultSetInterface $result_set, \Drupal\search_api\Query\QueryInterface $query, \Solarium\QueryType\Select\Result\Result $result) {
  $result_data = $result
    ->getData();
  if (isset($result_data['facet_counts']['facet_fields']['custom_field'])) {

    // Do something with $result_set.
  }
}