You are here

public function SolrBaseQuery::setAvailableSort in Apache Solr Search 6.3

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

Adds an available sort.

Parameters

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

array $sort: An array with the keys 'title', for the human name of the sort, and 'default', for the default sort direction ('asc' or 'desc').

Return value

DrupalSolrQueryInterface The called object.

Overrides DrupalSolrQueryInterface::setAvailableSort

File

./Solr_Base_Query.php, line 585
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 setAvailableSort($name, $sort) {

  // We expect non-aliased sorts to be added.
  $this->available_sorts[$name] = $sort;

  // Re-parse the sortstring.
  $this
    ->parseSortString();
  return $this;
}