You are here

public function SolrBaseQuery::setSolrsort in Apache Solr Search 8

Same name and namespace in other branches
  1. 6.3 Solr_Base_Query.php \SolrBaseQuery::setSolrsort()
  2. 7 Solr_Base_Query.php \SolrBaseQuery::setSolrsort()

Sets the sort.

Parameters

string $field: The name of the field in the Solr index to sort on.

string $direction: 'asc' or 'desc'

Return value

DrupalSolrQueryInterface The called object.

Overrides DrupalSolrQueryInterface::setSolrsort

File

./Solr_Base_Query.php, line 609
This class allows you to make operations on a query that will be sent to Apache Solr. methods such as adding and removing sorts, remove and replace parameters, adding and removing filters, getters and setters for various parameters and more

Class

SolrBaseQuery

Code

public function setSolrsort($name, $direction) {
  $this->sortstring = trim($name) . ' ' . trim($direction);
  $this
    ->parseSortString();
  return $this;
}