protected function SolrBaseQuery::parseSortString in Apache Solr Search 8
Same name and namespace in other branches
- 6.3 Solr_Base_Query.php \SolrBaseQuery::parseSortString()
- 7 Solr_Base_Query.php \SolrBaseQuery::parseSortString()
7 calls to SolrBaseQuery::parseSortString()
- SolrBaseQuery::addFieldAliases in ./Solr_Base_Query.php
- Handles aliases for field to make nicer URLs.
- SolrBaseQuery::clearFieldAliases in ./Solr_Base_Query.php
- SolrBaseQuery::removeAvailableSort in ./Solr_Base_Query.php
- Removes an available sort.
- SolrBaseQuery::setAvailableSort in ./Solr_Base_Query.php
- Adds an available sort.
- SolrBaseQuery::setAvailableSorts in ./Solr_Base_Query.php
... See full list
File
- ./Solr_Base_Query.php, line 558
- 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
protected function parseSortString() {
$sortstring = strtr($this->sortstring, $this->field_map);
if ('' == $sortstring || 'score desc' == $sortstring) {
$this->solrsort['#name'] = 'score';
$this->solrsort['#direction'] = 'desc';
unset($this->params['sort']);
}
else {
$fields = implode('|', array_keys($this->available_sorts));
if (preg_match('/^(?:(' . $fields . ') (asc|desc),?)+$/', $sortstring, $matches)) {
$this->solrsort['#name'] = $matches[1];
$this->solrsort['#direction'] = $matches[2];
$this->params['sort'] = array(
$sortstring,
);
}
}
}