Extend the solrconfig.xml file
The solrconfig.xml file defines Solr properties with default values. The default file can be extended using the jvm.options file, by using XInclude, or by configuring the SRCHCONFEXT table. The most common customization of the Solr configuration file is defining new values for replication and caching.
Procedure
Option 1
Follow instructions in the topic Tuning Just-In-Time compilers to add search server JVM arguments to the jvm.options file in the Search server.
Note: We cannot directly modify or extend the solrconfig.xml file. Instead, we can customize the jvm.options file to extend it, or use the procedure described here. The jvm.options file is a Java properties file that contains a series of key/value pairs. Each key/value pair is written on its own line. Values are assigned to the key using the equal ("=") sign. Prefix each key/value pair with -D. For instance,
-Dsolr.mergeFactor=100assigns the value 100 to the key solr.mergeFactor.
Option 2
We can use the standard XML feature XInclude to include the contents of a local file. The solrconfig.xml file includes an <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"> element, which looks for the file x-solrconfig.xml and includes its contents if it is found. Your search-config-ext project contains the file x-solrconfig.xml. Add our own content to this file. The template file includes some sample configurations that we can uncomment or further modify for our own use.
Note: XIinclude works only if x-solrconfig.xml is a self-contained XML object with a single root element. We cannot use variables (such as ${solr.data.dir:}) in this extension file.
Option 3
- Add or change the relevant values to the SRCHCONFEXT table. The values in SRCHCONFEXT override the default settings in the solrconfig.xml file. All of the variables in the following table are customizable. For example, to change the Solr document cache on the master server, then run the following SQL command on the master database. If we are changing multiple settings with the same statement, the key/value pairs must be comma-separated.
update srchconfext set config='solr.documentCache.size=0' where srchconfext_id=srchconfext_id;
- Restart the Search server.
Table 1. Customizable properties of the solrcore.properties file Property Default value solr.abortOnConfigurationError true solr.ext.dir solr.data.dir solr.directoryFactory solr.StandardDirectoryFactory solr.writeLockTimeout 1000 solr.maxIndexingThreads 8 solr.mergePolicy.maxMergeAtOnce 10 solr.mergePolicy.segmentsPerTier 10 solr.useCompoundFile false solr.ramBufferSizeMB 64 solr.mergeFactor 10 solr.lockType native solr.reopenReaders true solr.core.instanceDir /../CatalogEntry solr.deletionPolicy.maxCommitsToKeep 1 solr.deletionPolicy.maxOptimizedCommitsToKeep 0 solr.maxBooleanClauses 3072 solr.filterCache.size 1000 solr.filterCache.initialSize 100 solr.filterCache.autowarmCount 0 solr.queryResultCache.size 1000 solr.queryResultCache.initialSize 100 solr.queryResultCache.autowarmCount 0 documentCache solrLRUCache solr.documentCache.size 1000 solr.documentCache.initialSize 100 solr.documentCache.autowarmCount 0 solr.enableLazyFieldLoading true solr.queryResultWindowSize 36 solr.queryResultMaxDocsCached 36 solr.useColdSearcher false solr.maxWarmingSearchers 2 queryComponent query spellCheckComponent wc-spellcheck facetComponent facet data-config wc-data-config-dbtype.xml, where dbtype is either db2 or oracleImportant: If you replace this file with our own file, you need to include the appropriate dbtype suffix (for example, custom-data-config-dbtype.xml) so the file is picked up properly. masterCatalogId localeAlias indexScope ws.schema.name solr.replication.pollInterval 00:00:00 solr.clustering.enabled false solr.replication.classname com.ibm.commerce.foundation.internal.server.services.search.handler.solr.SolrSearchReplicationHandler admin.enable.replication true solr.master false solr.slave false solr.master.server.url /solr/${solr.core.name}/replication solr.core.name admin.enable.operation true conditionalCopyFieldChain.enable false healthCheckOps.enable false healthCheckOps.forceHealthCheckEveryPollInterval true healthCheckOps.checkOps com.ibm.commerce.foundation.solr.operation.SolrDoQueryCheckOperation,com.ibm.commerce.foundation.solr.operation.SolrDoStatusCheckOperation healthCheckOps.uponSuccessOps healthCheckOps.uponFailureOps com.ibm.commerce.foundation.solr.operation.SolrDoFetchIndexOperation solr.spellchecker.queryAnalyzerFieldType wc_textSpellCorrection solr.spellchecker.field spellCorrection solr.spellchecker.classname solr.DirectSolrSpellChecker solr.spellchecker.distanceMeasure internal solr.spellchecker.accuracy 0.3 solr.spellchecker.maxEdits 2 solr.spellchecker.minPrefix 1 solr.spellchecker.maxInspections 5 solr.spellchecker.minQueryLength 3 solr.spellchecker.maxQueryFrequency 0.01 solr.spellchecker.thresholdTokenFrequency 0.004 conditionalCopyFieldChain.enable false
Note: Detailed information about Solr and its options, parameters, and functions can be found on the
Apache Solr website.
Related concepts
Search configuration properties in the Solr configuration file (solrconfig.xml)