I have spent a few days trying to translate the configs from a Solr 3.x instance to Solr 5.5.x. The process was a bit devastating and consumed a lot of time. I did a lot of googling and browsing the documentation but I haven’t found one place with all the information essential to get things going. This is a summary of what I have done and what might be helpful for others. Let’s go!

image

🚀 solr.xml

TL;DR
Remove everything and use the default solr.xml found in $SOLR_HOME for the new version.

There are multiple changes to the solr.xml file. Solr has introduced cores autodiscovery so all <core> definitions can be removed. More on cores autodiscovery in the next step. The server persistency flag persistent=“(true|false)” has been deprecated and have to be removed. Cores with proper config files will be persisten by default.

🚀 Cores

Copy old core(s) configuration directories into $SOLR_HOME.

By default this will be the directory where solr.xml resides. For each core configuration copy the old directories to the $SOLR_HOME. The database data folder can stay the way they were in the old version, you will specify it’s folder later on.

Create an empty core.properties file in the main core directory.

By default solr will only autodiscover the cores which have the file present. The file has to exist and can be empty. The created core will have the same name as the directory the file is in. If you want to change it’s name or add other configuration options place them separately in each line in a simple key=value manner. It is explained quite well in the solr documentation. This is the place you should define the data directory for each core if it is not inside the core configuration directory.
E.g. config with a core name and data directory defined:

name=tobacco
dataDir=/var/solr/db/core_name

In the conf/solr.xml file remove all occurances of enablePositionIncrements with arguments.

The parameter has been deprecated in Solr 4 and can’t be used. If you happen to need this setting you should take a look at this thread on Solr jira.

Remove all definitions of fields for older versions of Solr.

The fields are usually documented with comments about consistency with older versions. I had to remove all this from my schema.xml to get my instance working:

<fieldType name="pint" class="solr.IntField"/>
<fieldType name="plong" class="solr.LongField"/>
<fieldType name="pfloat" class="solr.FloatField"/>
<fieldType name="pdouble" class="solr.DoubleField"/>
<fieldType name="pdate" class="solr.DateField" sortMissingLast="true"/>

<fieldType name="sint" class="solr.SortableIntField" sortMissingLast="true" omitNorms="true"/>
<fieldType name="slong" class="solr.SortableLongField" sortMissingLast="true" omitNorms="true"/>
<fieldType name="sfloat" class="solr.SortableFloatField" sortMissingLast="true" omitNorms="true"/>
<fieldType name="sdouble" class="solr.SortableDoubleField" sortMissingLast="true" omitNorms="true"/>

Change luceneMatchVersion in solrconfig.xml file to the solr version you have installed.

The core won’t work if the luceneMatchVersion won’t be changed to… match the current solr version. So for me it was 5.5.0.

Change directory ownership.

Check if all the cores directories belong to the solr user and change the ownership with chown -R solr: $SOLR_HOME

🚀 First run & debugging

After making all these changes run your newly created instance or restart it if it was already running and go to admin to check that your cores were loaded. If they were not loaded and you can’t seem to find any information on what has happened try loading the core manually from the admin. It should show you the errors with core initialization with the erroring files specified.

🚀 HTTP requests to the Solr server

In the code making requests to Solr you will need to remove all ContentType definitions. Solr 5 doesn’t accept passing ContentType in GET as well as POST requests.

🎉 All set!

This is it, let me know if you had any other problems and I will happily add more information. It seems Solr is not a pleasant piece of software at times 😎