Managing solrconfig.xml

As we already know now, solrconfig.xml forms the heart of Solr when it comes to configuring Solr.

There are two ways in which this file is modified:

  • By making direct changes in solrconfig.xml
  • Using the config API to create configoverlay.json, which holds configuration overlays to modify the default values specified in solrconfig.xml

The solrconfig.xml file is used to configure the admin web interface. It can be used to change parameters for replication and duplication. We can change the request dispatcher too using solrconfig.xml. Various listeners and request handlers can be configured using solrconfig.xml.

Go to any of the conf directories for a collection and you will find solrconfig.xml inside. Navigate to SOLR_HOME/server/solr/configsets and you will see various configurations that follow best practices for configuring Solr.

Solr allows you to specify a variable for the property value, which can be replaced at runtime with the following syntax:

${propertyname[:default value]}

Doing so will allow a default, which can be overridden when Solr is started. If we don't specify a default value, then it we should make sure that the property is specified at runtime or else we will get an error.

For example, take a look at this config:

 <autoCommit>
<maxTime>${solr.autoCommit.maxTime:15000}</maxTime>
<openSearcher>false</openSearcher>
</autoCommit>

In the preceding snippet, we have specified to keep the maximum time for doing a hard commit as 15 seconds.

This can be changed at runtime:

bin/solr start -Dsolr.autoCommit.maxTime=20000

In this way, we can set any Java system property at runtime.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.225.57.223