You are here: Configuration > Configuring Solr 3.5 Search Provider

Configuring Solr Search Provider


Solr is an enterprise level search engine. The quick setup instructions will result in a fully functional search engine for use with the ECF, and the additional instructions below the quick setup will detail how to configure a more complex environment and create a more customized and efficient Solr configuration.

The Solr search provider for ECF is built to work with Solr 3.5.0, the current version at the time the provider was released. While 3.5.0 is the officially supported versions, the provider is written to be compatible with future versions of Solr.

Quick Solr Setup

Step 1. Install Tomcat 6

Download the Windows Service Installer for Apache Tomcat 6 from, and run the installer. The default options will produce a working however we recommend that the "Native" option under the "Tomcat" node is selected on the components screen for best performance.

Within the directory where Tomcat was installed, edit the conf/server.xml file, and find the HTTP connector element (the port may be different, depending on your installation settings):

<Connector port="8080" protocol="HTTP/1.1"   
redirectPort="8443" />

Add the attribute URIEncoding="UTF-8" to this element to enable handling URIs with UTF-8 characters to the connector element. The Tomcat service will need to be restarted for this setting to take effect.

Step 2. Install the Solr application

Copy the contents of the Tools/Search/SolrServer350 directory from the ECF distribution into the Tomcat installation directory (the webapps directory from the ECF distribution will merge into an existing webapps directory in the Tomcat install.

The Tools/Search/SolrServer350 directory can be found in a zip file called "" in the folder "MediachaseECF", which is located in your web root (if you have not deleted the MediachaseECF folder).

If an older version of Solr is already installed in the Tomcat instance, the Tomcat service needs to be stopped, and all Solr files need to be removed from the Tomcat webapps directory before copying in this version. Unless other web applications have been installed in the Tomcat instance, this means deleting everything in the webapps folder except for the ROOT directory.)

Step 3. Configure the ECF Installation

Open the configs/Mediachase.Search.config files in each web application (both public sites and the commerce manager), and set the defaultProvider attribute of the SearchProviders element to "Solr35SearchProvider". In the provider element named "Solr35SearchProvider", set the URL attribute to point to the Solr application in your tomcat instance (http://{server}:{port}/solr, unless you have specifically configured a different application location).

Changing to a Multi-core Setup

If multiple applications are used for the ECF, a multi-core setup should be used. This will create separate configurations and search indexes for each application. If multiple instances of the ECF share the same Tomcat instance, they must use a multi-core setup, and a single application name may not be reused in more than one instance.

Complete the quick setup instructions above before switching to a multi-core configuration.

To add a core for an application, edit the solr/solr.xml file in the Tomcat instance. In the cores element, add a core element named with the application name followed by ".catalog", and a directory named with the application name. For example, if the application name is MyApplicationName, add line #4 from the following XML to your solr.xml file:

123456 <solr persistent="false"> 
<cores adminPath="/admin/cores">
<core instanceDir="catalog" name="catalog"/>
<core instanceDir="MyApplicationName" name="MyApplicationName.catalog"/>

Each core needs a directory for configuration and index files. For the default shared core, this is the solr/catalog directory in the Tomcat instance, as configured by the instanceDir value in the default "catalog" core.

To create a directory for the newly added core, copy the catalog directory from the Tools/Search/SolrServer350/solr directory in the ECF distribution into the solr directory in the Tomcat instance, and rename it to the application name (the value of the instanceDir attribute in the new core element).

Update the ECF search configuration by editing Mediachase.Search.config for each web application, and setting shareCores="false" in the Solr35SearchProvider provider element.

When these steps are completed, restart the Tomcat instance so that the changes will be loaded, and rebuild all indexes.

Customizing the Solr Schema for Your Catalog

The Solr configuration for each core includes a schema, describing the fields of the search documents and how they are stored and indexed. This configuration is contained in the Tomcat instance at solr/catalog/conf/schema.xml (for multi-core environments, replace catalog with the appropriate core directory). While the schema.xml provided with the ECF distribution should work for most implementations, more efficient indexing and searching performance can be achieved by customizing the schema for your own particular catalog configuration.

The catalog metafield edit screen of the commerce manager has five options for configuring the search properties of a metafield: Allow Search, Enable Sorting Search Results, Include Values in Search Results, Tokenize, and Include in the Default Search (some or all of these value may not be present for some metafield types).

A field does not have to have Allow Search checked to be included in the default search.

Note that if a field is not marked as tokenized, but is included in the default search, then the field will not be tokenized for faceting or on a direct search for that field; but the value copied into the default content value will be tokenized.

When the search properties are configured as desired, and the Solr35SearchProvider is configured as the default search provider, go to the Search Index screen within the Administration tab. This screen will now include a stub of generated code to customize the Solr schema configuration:

To make use of this generated schema configuration, edit the schema file in the Tomcat instance at solr/catalog/conf/schema.xml (replacing catalog with the appropriate directory for a multi-core configuration). Find the comments indicating the section of the configuration to replace with generated content (searching for "!!!" will go to the appropriate place in the file).

In the unmodified configuration, the section to replace has the following content:

<!-- !!! Replace content between this line and the next comment with "!!!" to use generated MetaData schema.xml configuration. -->   
<dynamicField name="*" type="text" indexed="true" stored="true" multiValued="false"/>
<copyField source="*" dest="_content"/>
<!-- !!! Replace content between this line and the previous comment with "!!!" to use generated MetaData schema.xml configuration. -->

Replace the content between these two comments with the XML copied out of the search index interface. To make use of the changes, the Tomcat instance must be restarted, and the index must be rebuilt.


Version: EPiServer Commerce 1 R2 SP2| Last updated: 2012-06-29 | Copyright © EPiServer AB | Send feedback to us