what does SetProperty of solr.home do in Solr?

75 Views Asked by At

I am trying to index some documents for search engine in Solr. in my piece of code, here is a part that I do nit understand:

System.SetProperty("solr.solr.home", "/home/emre/solr");
CoreContainer.Initializer Initializer = new CoreContainer.Initializer();

what does CoreContainer do? what does the first line of the code mean?

2

There are 2 best solutions below

0
On

I am assuming you are using EmbeddedSolrServer.

The EmbeddedSolrServer class provides an implementation of the SolrClient client API talking directly to an micro-instance of Solr running directly in your Java application.

solr.solr.home sets where the solr is installed.

you should read more about this here https://wiki.apache.org/solr/Solrj#EmbeddedSolrServer

Also just so that you know The use of EmbeddedSolrServer is not recommended.

Read here https://wiki.apache.org/solr/EmbeddedSolr

0
On

solr.solr.home points to the root of all your collections (not solr installation). There is a solr.xml there that defines global configuration. Under it - usually immediately but can be at any depth - there would be directories containing core.properties files, whose presence identify the root of the actual individual collection/core.