BROKEN CAMPAIGN CREATOR – FIXING SOLR ERRORS

A couple of week’s ago, I found a case where the Campaign Creator would not display any campaigns in one of our Sitecore CM instances. Upon closer inspection, we found a bunch of 500 errors in the browser console when trying to reach the following endpoint: ~/sitecore/api/ssc/CampaignManagement/Campaign.

When looking at the logs, we can see that opening the campaign creator would reproduce the following exception:

Exception System.InvalidCastException: Could not map index document field to property 'Culture' on type Sitecore.Marketing.Search.IndexedCampaign : Could not convert value of type System.Collections.ArrayList to destination type System.Globalization.CultureInfo: Unable to cast object of type 'System.Collections.ArrayList' to type 'System.String'. ---> System.InvalidCastException: Could not convert value of type System.Collections.ArrayList to destination type System.Globalization.CultureInfo: Unable to cast object of type 'System.Collections.ArrayList' to type 'System.String'. ---> System.InvalidCastException: Unable to cast object of type 'System.Collections.ArrayList' to type 'System.String'.
  at Sitecore.ContentSearch.Converters.IndexFieldCultureInfoValueConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
  at Sitecore.ContentSearch.Converters.IndexFieldStorageValueFormatter.ReadFromIndexStorage(Object indexValue, String fieldName, Type destinationType)
  --- End of inner exception stack trace ---

Inspecting this exception, we can find a couple of hints of where the issue might be. Sitecore.ContentSearch gives us big hint that the issue could be within our Solr instance. The second hint is an invalid cast on a “Culture” property from an array to a string.

Upon further research, we found that this property can be found within the Sitecore_MarketingDefinitions_master index. Opening our Solr console, we can run a query against this index, searching for the culture_t property.

As you can see, we can see some dodgy brackets in our results.

Incorrect culture_t results

This clearly pointed to an error in our index schema. When comparing our schema.xml file with one from a healthy Sitecore CM instance, where the Campaign Creator was working as expected. We see a weird attribute present in our schema.xml text_general field of our broken CM instance: multiValued=”true”

Removing this attribute, restarting our Solr service, and re indexing our offending index, produced the following results:

Correct culture_t results

As you can see, our offending arrays are gone, and best of all, the Campaign Creator is working as expected!

Leave a Reply

Your email address will not be published. Required fields are marked *