This post allows the user to override the Alfresco Solr configurations in the Alfresco SDK 3.0
TL;DR
- Override Tomcat’s Solr context configuration to point to custom Solr4 config dir.
- Copy default Solr configurations into this directory.
- Override new configurations as needed.
Override Solr Context Configurations
First we will add a config element in our main pom.xml that carries the property of our Solr configurations.
<solr.config.home>${basedir}/src/test/resources/solr4</solr.config.home>
Next we will edit the tomcat context configuration for Solr to use our new config element “solr.config.home.” This file can be found in src/resources/tomcat/context-solr.xml
<?xml version="1.0" encoding="UTF-8"?> <Context crossContext="true"> <Environment name="solr/home" type="java.lang.String" value="${solr.config.home}" override="true"/> <Environment name="solr/model/dir" type="java.lang.String" value="${solr.model.dir}" override="true"/> <Environment name="solr/content/dir" type="java.lang.String" value="${solr.content.dir}" override="true"/> </Context>
Copy Default configurations into new config folder
Next we will create a solr configuration folder under src/test/resources that will point to our custom solr configurations. In this setup, we use src/test/resources/solr4. This path is also the path configured in our “solr.config.home” property in our main pom.xml
Existing configurations can be found in the alf_data_dev directory, which was created when the SDK started up for the first time.
The configuration files and folders to copy are depicted in the following screenshot into the solr4 directory that we created:
At this point, you can override your solr configurations as needed.