protected function SearchApiSolrBackend::setSorts in Search API Solr 8.3
Same name and namespace in other branches
- 8 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::setSorts()
- 8.2 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::setSorts()
- 4.x src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::setSorts()
Sets sorting for the query.
Parameters
\Solarium\QueryType\Select\Query\Query $solarium_query: The Solarium query.
\Drupal\search_api\Query\QueryInterface $query: The Search API query.
Throws
\Drupal\search_api\SearchApiException
1 call to SearchApiSolrBackend::setSorts()
- 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
- src/
Plugin/ search_api/ backend/ SearchApiSolrBackend.php, line 4122
Class
- SearchApiSolrBackend
- Apache Solr backend for search api.
Namespace
Drupal\search_api_solr\Plugin\search_api\backendCode
protected function setSorts(Query $solarium_query, QueryInterface $query) {
$field_names = $this
->getSolrFieldNamesKeyedByLanguage($query
->getLanguages(), $query
->getIndex());
foreach ($query
->getSorts() as $field => $order) {
$solarium_query
->addSort(Utility::getSortableSolrField($field, $field_names, $query), strtolower($order));
}
}