You are here

public function Solr_Base_Query::add_filter in Apache Solr Search 5.2

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

Add a filter to a query

Parameters

string $field: the facet field to apply to this query

string value: the value of the facet to apply

boolean $exclude: Optional paramter. If TRUE, the filter will be negative, meaning that matching values will be excluded from the result set.

Overrides Drupal_Solr_Query_Interface::add_filter

File

./Solr_Base_Query.php, line 156

Class

Solr_Base_Query

Code

public function add_filter($field, $value, $exclude = FALSE, $callbacks = array()) {
  $filter = array(
    '#exclude' => $exclude,
    '#name' => $field,
    '#value' => trim($value),
    '#callbacks' => $callbacks,
  );
  $this->fields[] = $filter;
  $this->fields_added[] = $filter;
}