function apachesolr_views_query::build_where_string in Apache Solr Views 7
Build filter string from where array.
1 call to apachesolr_views_query::build_where_string()
- apachesolr_views_query::build in ./
apachesolr_views_query.inc - Builds what is necessary prior to executing the query.
File
- ./
apachesolr_views_query.inc, line 215 - Views query plugin for Apache Solr Views. Gets its data not from the database, but from a Solr server.
Class
- apachesolr_views_query
- @file Views query plugin for Apache Solr Views. Gets its data not from the database, but from a Solr server.
Code
function build_where_string($where) {
if (!isset($where['conditions'])) {
return $where['field'] . ':(' . $where['value'] . ')';
}
else {
$condition_strings = array();
foreach ($where['conditions'] as $condition) {
$condition_strings[] = $this
->build_where_string($condition);
}
$condition_strings = array_filter($condition_strings);
$condition_string = implode(' ' . $where['type'] . ' ', $condition_strings);
// Respect grouping by wrapping multiple conditions with parenthesis.
if (count($condition_strings) > 1) {
$condition_string = '(' . $condition_string . ')';
}
return $condition_string;
}
}