protected function SolrBaseQuery::addFq in Apache Solr Search 6.3
Same name and namespace in other branches
- 8 Solr_Base_Query.php \SolrBaseQuery::addFq()
- 7 Solr_Base_Query.php \SolrBaseQuery::addFq()
1 call to SolrBaseQuery::addFq()
- SolrBaseQuery::addParam in ./
Solr_Base_Query.php - Adds a param to be sent when running the Solr search.
File
- ./
Solr_Base_Query.php, line 435 - 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
Code
protected function addFq($string, $index = NULL) {
$string = trim($string);
$local = '';
$exclude = FALSE;
$name = NULL;
$value = NULL;
// Check if we are dealing with an exclude
if (preg_match('/^-(.*)/', $string, $matches)) {
$exclude = TRUE;
$string = $matches[1];
}
// If {!something} is found as first character then this is a local value
if (preg_match('/\\{!([^}]+)\\}(.*)/', $string, $matches)) {
$local = $matches[1];
$string = $matches[2];
}
// Anything that has a name and value
// check if we have a : in the string
if (strstr($string, ':')) {
list($name, $value) = explode(":", $string, 2);
}
else {
$value = $string;
}
$this
->addFilter($name, $value, $exclude, $local);
return $this;
}