Setting up Solr

Setting up Solr for Sitecore Commerce 8.2.1 involves following the Solr set up instructions for the Sitecore Experience Platform, and adding the Commerce-specific configuration in the appropriate steps.

Follow the Sitecore Experience Platform instructions in Walkthrough: Setting up Solr to set up Solr and to generate the default Solr Schema.xml file.

Note: Also refer to the Solr Compatibility Table Knowledge Base article. For Solr versions 5.5.1 and later, follow the instructions for Solution [2].

Solr XML Schema additions

When following the instructions in Walkthrough: Setting up Solr, after performing the Generate an XML Schema for Solr step, add the following Commerce settings to the Solr Schema.xml file:

<field name="productid" type="lowercase" indexed="true" stored="true" />

<field name="email_address" type="lowercase" indexed="true" stored="true" />

<field name="last_name" type="lowercase" indexed="true" stored="true" />

<field name="first_name" type="lowercase" indexed="true" stored="true" />

<field name="profiletype" type="lowercase" indexed="true" stored="true" />

<field name="externalid" type="lowercase" indexed="true" stored="true" />

<field name="user_id" type="lowercase" indexed="true" stored="true" />

<field name="preferred_address" type="lowercase" indexed="true" stored="true" />

<field name="account_status" type="lowercase" indexed="true" stored="true" />

<field name="user" type="lowercase" indexed="true" stored="true" />

<dynamicField name="*_tm" type="text_general" indexed="true" stored="true" multiValued="true"/>

<dynamicField name="*_sci" type="string_ci" indexed="true" stored="true" />

<dynamicField name="*_t_en" type="text_general" indexed="true" stored="true" />

<dynamicField name="*_t_ja" type="text_general" indexed="true" stored="true" />

<dynamicField name="*_t_de" type="text_general" indexed="true" stored="true" />

<dynamicField name="*_t_fr" type="text_general" indexed="true" stored="true" />


<fieldType name="string_ci" class="solr.TextField" sortMissingLast="true" omitNorms="true">
             <analyzer>
                  <tokenizer class="solr.KeywordTokenizerFactory"/>
                  <filter class="solr.LowerCaseFilterFactory" />
             </analyzer>
</fieldType>
Note: The Commerce settings previously listed are based on the default Sitecore Commerce deployment as documented in the Sitecore Commerce 8.2.1 Deployment Guide. You may need to adjust these settings for your own custom fields.

Next, apply this modified Solr XML Schema to each of the following indexes (cores) used by Commerce:

  • commerce_orders_index
  • commerce_promotions_index
  • commerce_userprofiles_index_master
  • itembuckets_commerce_products_master_index
  • itembuckets_commerce_products_web_index
  • sitecore_web_index
  • sitecore_master_index
Note: Some settings may not apply for a particular index. However, you can use the same modified Solr XML Schema for all them.

Configuration file updates

When following the instructions in Walkthrough: Setting up Solr, during the Configure Sitecore to work with Solr step, also modify the Commerce configuration files to disable the Lucene default and enable Solr. Replace Lucene with Solr in the following groups of Commerce configuration files:

  • Website\Include\Y.Commerce.Engine\*.Lucene.config
  • Website\Include\CommerceServer\*.Lucene.*.config
  • Website\Include\Reference.Storefront\*.Lucene.config
  • Website\Include\Sitecore.Speak.ContentSearch.Lucene.config

In general, make sure that the following configuration files for both Lucene and Solr remain disabled. These files are only enabled if you are using the Synchronization feature in Commerce Connect, which is typically used to integrate the Sitecore Experience Platform with a third-party commerce system instead of using Sitecore Commerce.

  • Website\Include\Sitecore.Commerce.Products.Lucene.*.config
  • Website\Include\Sitecore.Commerce.Products.Solr.*.config
Note: If you have deployed the Reference store front sample site, it uses the default Solr service address in Website\App_Config\Include\Reference.Storefront\Reference.Storefront.Index.Solr.config. If you have changed the Solr service address, such as using a different hostnasme, a different port, and so on, you need to update the setting.

<setting name="ContentSearch.Solr.ServiceBaseAddress>
  <patch:attribute name="value">http://localhost:8080/solr</patch:attribute>
</setting>