Skip to content
Snippets Groups Projects
Commit 33afdb39 authored by Jochen Lienhard's avatar Jochen Lienhard Committed by Demian Katz
Browse files

Modified SolrWeb to read more configs from website.ini.

parent ef6ff403
No related merge requests found
...@@ -24,3 +24,17 @@ title = sort_title ...@@ -24,3 +24,17 @@ title = sort_title
category = "Category" category = "Category"
linktype = "Link Type" linktype = "Link Type"
subject = "Subject" subject = "Subject"
[Results_Settings]
facet_limit = 30 ; how many values should we show for each facet?
; Should we show "exclude" links for some or all of the facets? Set to * for
; all facets, use a comma-separated list to show for some of the facets, set
; to false or omit to disable "exclude" links
;exclude = *
; This section defines the location of the website Solr index; if it is omitted,
; a default_core of "website" will be used, and the url will be inherited from
; the [Index] section of config.ini.
;[Index]
;url = http://localhost:8080/solr
;default_core = website
...@@ -47,12 +47,37 @@ class SolrWebBackendFactory extends AbstractSolrBackendFactory ...@@ -47,12 +47,37 @@ class SolrWebBackendFactory extends AbstractSolrBackendFactory
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
$this->solrCore = 'website';
$this->searchConfig = 'website'; $this->searchConfig = 'website';
$this->searchYaml = 'websearchspecs.yaml'; $this->searchYaml = 'websearchspecs.yaml';
$this->facetConfig = 'website'; $this->facetConfig = 'website';
} }
/**
* Get the Solr core.
*
* @return string
*/
protected function getSolrCore()
{
$config = $this->config->get($this->searchConfig);
return isset($config->Index->default_core)
? $config->Index->default_core : 'website';
}
/**
* Get the Solr URL.
*
* @return string
*/
protected function getSolrUrl()
{
// Allow the searchConfig to override the default config if set.
$webconfig = $this->config->get($this->searchConfig);
return isset($webconfig->Index->url)
? $webconfig->Index->url . '/' . $this->getSolrCore()
: parent::getSolrUrl();
}
/** /**
* Create the SOLR backend. * Create the SOLR backend.
* *
......
...@@ -91,7 +91,7 @@ class Params extends \VuFind\Search\Base\Params ...@@ -91,7 +91,7 @@ class Params extends \VuFind\Search\Base\Params
{ {
parent::__construct($options, $configLoader); parent::__construct($options, $configLoader);
// Use basic facet limit by default, if set: // Use basic facet limit by default, if set:
$config = $configLoader->get('facets'); $config = $configLoader->get($options->getFacetsIni());
if (isset($config->Results_Settings->facet_limit) if (isset($config->Results_Settings->facet_limit)
&& is_numeric($config->Results_Settings->facet_limit) && is_numeric($config->Results_Settings->facet_limit)
) { ) {
......
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