You are here

function apachesolr_views_query::get_filters in Apache Solr Views 6

return an array of filters

Parameters

string $name: the name of the filter applied to the query

Compabatiablity layer with Solr_Base_Query

File

./apachesolr_views_query.inc, line 764

Class

apachesolr_views_query
Class for handling a view that gets its data not from the database, but from a Solr server.

Code

function get_filters($name = NULL) {
  $filters = array();
  foreach ($this->_facets as $type => $fields) {
    foreach ($fields as $data) {
      $filters[] = array(
        '#name' => $data['exclude'] ? "NOT {$type}" : $type,
        '#value' => $data['value'],
      );
    }
  }

  // if we are looking for a specific one
  // remove all those that don't match and return the array
  if (!empty($name)) {
    foreach ($filters as $key => $filter) {
      if ($filter['#name'] != $name) {
        unset($filters[$key]);
      }
    }
  }
  return $filters;
}