Search the documentation
 Show GitHub edit links  Hide GitHub edit links
In OpenCms since: 8.5 Documented since: 9.5 Latest revision for: 9.5 Valid for OpenCms: 10.5.3

The system wide configuration of the Solr search engine is done in the opencms-search.xml. Here you can disable/enable Solr and configure the Solr server.

There are other configuration files for Solr (in the folder {webapp home}/WEB-INF/solr) whose options are not covered here.

System wide configuration

In general the system wide search configuration for OpenCms is done in the file opencms-search.xml ({webapp home}/WEB_INF/config/opencms-search.xml). In the following subsections we explain the different configuration options.

Enable Solr and configure the Solr server

In the node opencms/solr you configure if you want to enable the Solr search engine at all and optionally set additional configuration options. You can also connect to an external Solr server. Here's the simplest configuration to enable the Solr search engine:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE opencms SYSTEM "http://www.opencms.org/dtd/6.0/opencms-search.dtd">
<opencms>
 <search>
   <solr enabled="true"/>
   <!-- ... -->
 </search>
</opencms>

To disable Solr just set the attribute enabled to false.

Connecting to an external Solr server

The default OpenCms installation includes a Solr server that is reached under the SolrSelect request handler http://{hostname}/{webapp name}/handleSolrSelect. You can also use, also if we do not recommend it unless you have serious issues with the integrated server, a different server for the search using the attribute serverUrl at the <solr> node:

<solr enabled="true" serverUrl="http://mySolrServer" />

If you use an external Solr server, be aware that:

The OpenCms SolrSelect request handler does not support the external HTTP Solr Server.

And if your Solr Server is directly reachable by http://<your_server> there will be no permission check performed and indexed data that is secret will be accessible.

That means that you are responsible for resources that have permission restrictions set on the VFS of OpenCms.

To use the permission checking you could allow to access your server only via the Java API and use the search methods of org.opencms.search.solr.CmsSolrIndex.

Optional extra configuration for the server

The <solr> node has several optional subnodes to change default settings form the Solr server. Here is a configuration example using all options:

<solr enabled="true">
   <home>/my/solr/home/folder</home>
   <configfile>rabbit.xml</configfile>
   <commitWithinMs>10000</commitWithinMs>
</solr>
Optional configuration nodes for the Solr server
<home>

Sets the Solr home folder (without trailing /). By default this is {webapp home}/WEB-INF/solr.

<configfile>

The name of the Solr configuration file. The default file name is solr.xml. It's URL will be concatenated as {home folder}/{file name}.

<commitWithinMs>

The maximal time Solr is allowed to wait between adding a document and committing it. SeeĀ here for more information.

You can improve this page

Please contribute your suggestions or comments regarding this topic on our wiki. For support questions, please use the OpenCms mailing list or go for professional support.