diff --git a/module/VuFind/src/VuFind/Search/Factory/AbstractSolrBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/AbstractSolrBackendFactory.php index e0b775a93230fc094dcf249f95d16bf1c323cb1d..c41b4e9c2b847693fee4a8aeba887ac1170da9f9 100644 --- a/module/VuFind/src/VuFind/Search/Factory/AbstractSolrBackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/AbstractSolrBackendFactory.php @@ -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(