You are here

public function SolrFilterSubQuery::addFilter in Apache Solr Search 7

Same name and namespace in other branches
  1. 8 Solr_Base_Query.php \SolrFilterSubQuery::addFilter()
  2. 6.3 Solr_Base_Query.php \SolrFilterSubQuery::addFilter()
1 call to SolrFilterSubQuery::addFilter()
SolrBaseQuery::addFq in ./Solr_Base_Query.php

File

./Solr_Base_Query.php, line 71
This class allows you to make operations on a query that will be sent to Apache Solr. methods such as adding and removing sorts, remove and replace parameters, adding and removing filters, getters and setters for various parameters and more

Class

SolrFilterSubQuery
This class allows you to make operations on a query that will be sent to Apache Solr. methods such as adding and removing sorts, remove and replace parameters, adding and removing filters, getters and setters for various parameters and…

Code

public function addFilter($name, $value, $exclude = FALSE, $local = '') {

  // @todo - escape the value if it has spaces in it and is not a range query or parenthesized.
  $filter = array(
    '#exclude' => (bool) $exclude,
    '#name' => trim($name),
    '#value' => trim($value),
    '#local' => trim($local),
  );
  $this->fields[] = $filter;
  return $this;
}