You are here

public function apachesolr_views_handler_sort::query in Apache Solr Views 6

Same name and namespace in other branches
  1. 7 handlers/apachesolr_views_handler_sort.inc \apachesolr_views_handler_sort::query()

Places the sort into the search parameters.

File

handlers/apachesolr_views_handler_sort.inc, line 12

Class

apachesolr_views_handler_sort
Class for sorting for a field.

Code

public function query() {

  /* These fields have a special "*_sort" field for sorting: */
  $special_sort_fields = array(
    'name' => 'sort_name',
    'title' => 'sort_title',
  );
  $order = strtolower($this->options['order']);
  if (empty($special_sort_fields[$this->real_field])) {
    $this->query
      ->add_sort($this->real_field, $order);
  }
  else {
    $this->query
      ->add_sort($special_sort_fields[$this->real_field], $order);
  }
}