We know that computers understand programming languages but how about making them understand human language, the language that you and me speak? Natural Language Processing (NLP)...
By: Dikshant Shahi | May 15, 2015
How does Solr discover a core?
If you are a seasoned Solr developer and yet to migrate to latest releases, your answer might be ‘by registering the core by adding <cores> element in solr.xml’. Yes, this is absolutely correct for releases < Solr 4.4 and even works good for newer 4.x releases but is supposed to fail with 5.x releases.
Solr 5.x no longer supports <cores> element. It introduces the core discovery mechanism. To migrate from legacy mechanism of <cores> element, you need to start with removing all the <cores> entry and creating a file core.properties in the instanceDir of the core.
Solr discovers the core on the basis of core.properties file and this file can exist in any deep directory i.e. even in a sub-directory and that directory will be treated as core instanceDir. Below is an example, in which core1 is the core instanceDir and is three level deep.
The core.properties file is a Java properties file and the simplest file can be empty file, if your core runs with all default settings. If you want to configure properties for the core, you can do it in this file as below.
In the above example, we provided the default name for config and schema but if you want, you can rename it to any preferred name.
You can also define you custom properties in this file and use it across the core like in solrconfig.xml, schema.xml etc. But this feature has an open bug SOLR-5931 and the properties doesn’t reload on reloading the core. Hence, don’t configure the properties which change frequently until the issue is resolved. But definitely core discovery provides very convenient and easy approach for discovering core and also a central point for maintaining properties.