function hook_search_api_solr_search_results_alter in Search API Solr 8
Same name and namespace in other branches
- 8.3 search_api_solr.api.php \hook_search_api_solr_search_results_alter()
- 8.2 search_api_solr.api.php \hook_search_api_solr_search_results_alter()
- 7 search_api_solr.api.php \hook_search_api_solr_search_results_alter()
- 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 $results: 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 $resultset: The Solarium result object.
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 73 - 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.
}
}