From 18e55ac426254708909c93bf1a25965b67e1e554 Mon Sep 17 00:00:00 2001 From: Thomas Mortagne <thomas.mortagne@gmail.com> Date: Fri, 3 Apr 2020 16:03:18 +0200 Subject: [PATCH] XWIKI-17183: solr.remote.url property in xwiki.properties does not work anymore --- .../org/xwiki/search/solr/internal/RemoteSolr.java | 10 ++++++++-- .../src/main/resources/xwiki.properties.vm | 6 +++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-api/src/main/java/org/xwiki/search/solr/internal/RemoteSolr.java b/xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-api/src/main/java/org/xwiki/search/solr/internal/RemoteSolr.java index d1f5830fe44..ad09b1fb05d 100644 --- a/xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-api/src/main/java/org/xwiki/search/solr/internal/RemoteSolr.java +++ b/xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-api/src/main/java/org/xwiki/search/solr/internal/RemoteSolr.java @@ -63,9 +63,15 @@ public class RemoteSolr extends AbstractSolr implements Initializable @Override public void initialize() throws InitializationException { - String remoteURL = this.configuration.getInstanceConfiguration(TYPE, "baseURL", DEFAULT_REMOTE_URL); + String baseURL = this.configuration.getInstanceConfiguration(TYPE, "baseURL", DEFAULT_REMOTE_URL); - this.rootClient = new HttpSolrClient.Builder(remoteURL).build(); + this.rootClient = new HttpSolrClient.Builder(baseURL).build(); + + // RETRO COMPATIBILITY: the seach core used to be configured using "solr.remote.url" property + String searchCoreURL = this.configuration.getInstanceConfiguration(TYPE, "url", null); + if (searchCoreURL != null) { + this.clients.put("search", new HttpSolrClient.Builder(searchCoreURL).build()); + } } @Override diff --git a/xwiki-platform-tools/xwiki-platform-tool-configuration-resources/src/main/resources/xwiki.properties.vm b/xwiki-platform-tools/xwiki-platform-tool-configuration-resources/src/main/resources/xwiki.properties.vm index ed7c4f5185f..eb8d2b26761 100644 --- a/xwiki-platform-tools/xwiki-platform-tool-configuration-resources/src/main/resources/xwiki.properties.vm +++ b/xwiki-platform-tools/xwiki-platform-tool-configuration-resources/src/main/resources/xwiki.properties.vm @@ -583,10 +583,10 @@ extension.versioncheck.environment.enabled=$xwikiPropertiesEnvironmentVersionChe #-# The default is the subfolder "store/solr" inside folder defined by the property "environment.permanentDirectory". # solr.embedded.home=/var/local/xwiki/store/solr -#-# [Since 4.5M1] -#-# The URL to use to connect to the remote solr server. +#-# [Since 12.2] +#-# The URL of the Solr server (the root server and not the URL of a core). #-# The default value assumes that the remote Solr server is started in a different process on the same machine, using the default port. -# solr.remote.url=http://localhost:8983/solr +# solr.remote.baseURL=http://localhost:8983/solr #-# [Since 5.1M1] #-# Elements to index are not sent to the Solr server one by one but in batch to improve performances. -- GitLab