How to enable SOLR for Sitecore Commerce Connect 8 – new fields needed in Schema.xml

By September 3, 2015 No Comments

If you are using Solr for indexes and you decide to install the Sitecore Commerce connect module you need to make sure you add the newly added fields to your Solr Code indexes.
Sitecore is not very clear about these post-installation steps in the Commerce Connect 8.0 Installation Guide, but some old article explains this in detail.

The error

Job started: Index_Update_IndexName=sitecore_web_index  
#Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> SolrNet.Exceptions.SolrConnectionException: <?xml version="1.0" encoding="UTF-8"?>
<lst name="responseHeader"><int name="status">400</int><int name="QTime">37</int></lst><lst name="error"><str name="msg">ERROR: unknown field '__quick_action_bar_validation_rules_tm'</str><int name="code">400</int></lst>  
 ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.
   at System.Net.HttpWebRequest.GetResponse()
   at HttpWebAdapters.Adapters.HttpWebRequestAdapter.GetResponse()
   at SolrNet.Impl.SolrConnection.GetResponse(IHttpWebRequest request)
   at SolrNet.Impl.SolrConnection.PostStream(String relativeUrl, String contentType, Stream content, IEnumerable`1 parameters)
   --- End of inner exception stack trace ---
   at SolrNet.Impl.SolrConnection.PostStream(String relativeUrl, String contentType, Stream content, IEnumerable`1 parameters)
   at SolrNet.Impl.SolrConnection.Post(String relativeUrl, String s)
   at SolrNet.Impl.SolrBasicServer`1.SendAndParseHeader(ISolrCommand cmd)
   at Sitecore.ContentSearch.SolrProvider.SolrBatchUpdateContext.AddRange(IEnumerable`1 group, Int32 groupSize)

The fix:

In order to fix your Solr indexes you need to add the following fields to the generated Schema.xml

<!-- Fields for Commerce Connect -->  
<dynamicField name="*_tm" type="text_general" indexed="true" stored="true" multiValued="true"/>  
<dynamicField name="*_sci" type="string_ci" indexed="true" stored="true" />

<!--  Field type for Comemrce Connect -->  
<fieldType name="string_ci" class="solr.TextField" sortMissingLast="true" omitNorms="true">  
      <tokenizer class="solr.KeywordTokenizerFactory"/>
      <filter class="solr.LowerCaseFilterFactory" />
Adrian Iorgu

Author Adrian Iorgu

Results-oriented and self-motivated lead engineer with a focus on delivering high-quality code and products in high traffic environments. Sitecore MVP 2016 & 2017

More posts by Adrian Iorgu

Leave a Reply