The Gitlab instance will be restarted on Monday April 28th at 2AM. There will be a short interruption of service.

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

Make Solr backend factories more extensible.

parent aae10706
No related merge requests found
......@@ -266,11 +266,13 @@ abstract class AbstractSolrBackendFactory implements FactoryInterface
/**
* Get the Solr URL.
*
* @param string $config name of configuration file (null for default)
*
* @return string|array
*/
protected function getSolrUrl()
protected function getSolrUrl($config = null)
{
$url = $this->config->get('config')->Index->url;
$url = $this->config->get($config ?? 'config')->Index->url;
$core = $this->getSolrCore();
if (is_object($url)) {
return array_map(
......
......@@ -68,15 +68,17 @@ class SolrWebBackendFactory extends AbstractSolrBackendFactory
/**
* Get the Solr URL.
*
* @param string $config name of configuration file (null for default)
*
* @return string
*/
protected function getSolrUrl()
protected function getSolrUrl($config = null)
{
// 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();
// Only override parent default if valid value present in config:
$configToCheck = $config ?? $this->searchConfig;
$webConfig = $this->config->get($configToCheck);
$finalConfig = isset($webConfig->Index->url) ? $configToCheck : null;
return parent::getSolrUrl($finalConfig);
}
/**
......
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