You are here

public function Solr_Base_Query::get_url_queryvalues in Apache Solr Search 6.2

Same name and namespace in other branches
  1. 5.2 Solr_Base_Query.php \Solr_Base_Query::get_url_queryvalues()
  2. 6 Solr_Base_Query.php \Solr_Base_Query::get_url_queryvalues()

Return filters and sort in a form suitable for a query param to url().

Overrides Drupal_Solr_Query_Interface::get_url_queryvalues

File

./Solr_Base_Query.php, line 336

Class

Solr_Base_Query

Code

public function get_url_queryvalues() {
  $queryvalues = array();
  $filters = array();
  foreach ($this->fields as $pos => $field) {

    // Look for a field alias.
    if (isset($this->field_map[$field['#name']])) {
      $field['#name'] = $this->field_map[$field['#name']];
    }
    $filters[] = $this
      ->make_filter($field);
  }
  if ($filters) {
    $queryvalues['filters'] = implode(' ', $filters);
  }
  $solrsort = $this->solrsort;
  if ($solrsort && ($solrsort['#name'] != 'score' || $solrsort['#direction'] != 'desc')) {
    if (isset($this->field_map[$solrsort['#name']])) {
      $solrsort['#name'] = $this->field_map[$solrsort['#name']];
    }
    $queryvalues['solrsort'] = $solrsort['#name'] . ' ' . $solrsort['#direction'];
  }
  return $queryvalues;
}