on ‎2019 Jun 02 8:24 PM
Starting with Commerce 1808, Solr customizations are completely redesigned, but it does not seem to be thought to the end.
Solr server 7.7.1 is found in /ext-commerce/solrserver/resources/solr/7.7/server, while customizations are placed in /ext-commerce/solrserver/resources/solr/7.7/customizations.
We use these customizations to add some field types and fields to our solr schema.xml in the default configset (/ext-commerce/solrserver/resources/solr/7.7/customizations/files/server/solr/configsets/default/conf/schema.xml).
When running the default Solr instance (solrserver.instances.default.autostart=true, solrserver.instances.default.mode=standalone), there is some magic going on to produce the config files used for the solr server instance:
de.hybris.platform.solr.controller.commands.StartSolrServerCommand from /ext-commerce/solrserver/resources/solr/7.7/server/contrib/hybris/controller-libs/solr-hybris-controller-7.7.1.jar) is executed
this creates a new instance of CreateSolrInstanceCommand (from the same package and jar) and executes it
CreateSolrInstanceCommand end up in calling internal protected method createInstanceConfigDirectory, which will create the /hybris/config/solr/instances/default folder and copy into it the solr config from /ext-commerce/solrserver/resources/solr/7.7/server/server/solr .
Something like this is in the console:
Jun 02, 2019 3:22:35 PM de.hybris.platform.solr.controller.commands.StartSolrServersCommand executeCommand
INFO: Starting Solr servers ...
Jun 02, 2019 3:22:35 PM de.hybris.platform.solr.controller.commands.CreateSolrInstanceCommand createInstanceConfigDirectory
INFO: Creating config directory '/Users/user/hybris/config/solr/instances/default' for Solr instance [name: default, hostname: myhost, port: 8983, mode: STANDALONE]
Jun 02, 2019 3:22:35 PM de.hybris.platform.solr.controller.commands.StartSolrServerCommand getSolrServerStatus
INFO: Checking Solr server status for instance [name: default, hostname: myhost, port: 8983, mode: STANDALONE]
Jun 02, 2019 3:22:36 PM de.hybris.platform.solr.controller.commands.StartSolrServerCommand startSolrServer
INFO: Starting Solr server for instance [name: default, hostname: myhost, port: 8983, mode: STANDALONE]
Waiting up to 180 seconds to see Solr running on port 8983 [\]
Started Solr server on port 8983 (pid=838). Happy searching!
PROBLEM: the customizations folder is not copied also over the standard config folder, thus the default Solr instance configuration does not have any applied customizations. Since this config folder is deleted at each clean build, manually "fixing" the issue quickly becomes a pain.
In the past, we extended the DefaultSolrServerService#createInstanceConfigDirectory to also carry over the customizations, but this mechanism is now deprecated and no longer used.
But with Commerce 1808, there does not seem to be any way to customize the commands executed at startup, especially the CreateSolrInstanceCommand. The method createInstanceConfigDirectory in it is protected, but providing an implementation that extends the behaviour is not possible because the caller (StartSolrServerCommand) creates explicitely a new instance of this CreateSolrInstanceCommand... No factory, no Spring dependency injection, nothing. Use it as it is ...
Anyone facing this issue and having a usable solution?
Thanks, Cristi C.
Request clarification before answering.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.