Skip to content
Snippets Groups Projects
Commit df02a7f8 authored by Demian Katz's avatar Demian Katz
Browse files

Created support method for determining hidden filter settings.

parent 1e533954
Branches
Tags
No related merge requests found
......@@ -231,6 +231,33 @@ abstract class AbstractSolrBackendFactory implements FactoryInterface
return $this->config->get('config')->Index->url . '/' . $this->getSolrCore();
}
/**
* Get all hidden filter settings.
*
* @return array
*/
protected function getHiddenFilters()
{
$search = $this->config->get($this->searchConfig);
$hf = array();
// Hidden filters
if (isset($search->HiddenFilters)) {
foreach ($search->HiddenFilters as $field => $value) {
$hf[] = sprintf('%s:"%s"', $field, $value);
}
}
// Raw hidden filters
if (isset($search->RawHiddenFilters)) {
foreach ($search->RawHiddenFilters as $filter) {
$hf[] = $filter;
}
}
return $hf;
}
/**
* Create the SOLR connector.
*
......@@ -239,7 +266,6 @@ abstract class AbstractSolrBackendFactory implements FactoryInterface
protected function createConnector()
{
$config = $this->config->get('config');
$search = $this->config->get($this->searchConfig);
$handlers = array(
'select' => array(
......@@ -252,24 +278,8 @@ abstract class AbstractSolrBackendFactory implements FactoryInterface
),
);
// Hidden filters
if (isset($search->HiddenFilters)) {
foreach ($search->HiddenFilters as $field => $value) {
array_push(
$handlers['select']['appends']['fq'],
sprintf('%s:"%s"', $field, $value)
);
}
}
// Raw hidden filters
if (isset($search->RawHiddenFilters)) {
foreach ($search->RawHiddenFilters as $filter) {
array_push(
$handlers['select']['appends']['fq'],
$filter
);
}
foreach ($this->getHiddenFilters() as $filter) {
array_push($handlers['select']['appends']['fq'], $filter);
}
$connector = new Connector(
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment