public function Solr_Base_Query::add_filter in Apache Solr Search 6.2
Same name and namespace in other branches
- 5.2 Solr_Base_Query.php \Solr_Base_Query::add_filter()
- 6 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) If TRUE, the filter will be negative, meaning that matching values will be excluded from the result set. Defaults to FALSE.
Overrides Drupal_Solr_Query_Interface::add_filter
File
- ./
Solr_Base_Query.php, line 179
Class
Code
public function add_filter($name, $value, $exclude = FALSE, $callbacks = array()) {
$filter = array(
'#exclude' => $exclude,
'#name' => $name,
'#value' => trim($value),
'#callbacks' => $callbacks,
);
// Record the addition.
$this->fields_added[] = $filter;
// Add to the public list of filters.
$this->fields[] = $filter;
// Remove from the record of removed filters.
$this
->unset_filter($this->fields_removed, $name, $value);
}