protected function Solr_Base_Query::rebuild_fq in Apache Solr Search 5.2
Same name and namespace in other branches
- 6 Solr_Base_Query.php \Solr_Base_Query::rebuild_fq()
- 6.2 Solr_Base_Query.php \Solr_Base_Query::rebuild_fq()
Builds a set of filter queries from $this->fields and all subqueries.
Returns an array of strings that can be combined into a URL query parameter or passed to Solr as fq paramters.
2 calls to Solr_Base_Query::rebuild_fq()
- Solr_Base_Query::get_fq in ./
Solr_Base_Query.php - Solr_Base_Query::get_url_queryvalues in ./
Solr_Base_Query.php - Return filters and sort in a form suitable for a query param to url().
File
- ./
Solr_Base_Query.php, line 452
Class
Code
protected function rebuild_fq($aliases = FALSE) {
$fq = array();
$fields = array();
foreach ($this->fields as $pos => $field) {
// Look for a field alias.
if ($aliases && isset($this->field_map[$field['#name']])) {
$field['#name'] = $this->field_map[$field['#name']];
}
$fq[] = $this
->make_filter($field);
}
foreach ($this->subqueries as $id => $data) {
$subfq = $data['#query']
->rebuild_fq($aliases);
if ($subfq) {
$operator = $data['#fq_operator'];
$fq[] = "(" . implode(" {$operator} ", $subfq) . ")";
}
}
return $fq;
}