A/B Testing is great
Sitecore’s Experience Optimization content testing functionality is a powerful tool in the Sitecore XP arsenal. When coupled with a solid engagement value strategy, marketers can get deep insights into what actually works (rather than what we think may work).
….when it works
Recently we hit an issue in a recently upgraded (8.2 -> 9.0.1) installation that would not display newly created tests correctly. The process of creating the test all went smoothly, the test would actually be running…but it would not display in the “Active Tests” tab of Experience Optimization. Drafts and Historical tests all displayed as expected.
Testing through our environments identified that things were working locally, but any upstream deployments all reproduced the issue.
All tests get indexed by your search provider upon creation. As part of the upgrade we’d also switched search providers to Azure Search (locally we use SOLR) so thought I’d investigate the [sitecore-testing-index]. All looked ok ¯\_(ツ)_/¯ . Documents were being added for each test we created with what seemed appropriate data. There was also a fairly cryptic INFO message in the logs when attempting to load the Active tests:
9300 02:31:53 INFO AzureSearch Query [sitecore_testing_index]: &search=This_Is_Equal_ConstNode_Return_Nothing
After hitting up colleagues and Sitecore community slack we were still at a loss, so raised a Sitecore support ticket. After an open dialogue and many configs later, we had a solution!
This was a config issue with Azure search. One of the Sitecore fields to be added to the [sitecore-testing-index] is a flag to whether the test is running (“__is running“). The default configs fail to add this field to the index correctly. Easily fixed…..it’s a one line change (isn’t it always?).
The Content Testing configs for 9.0.1 (and 9.0.2) provided in the Sitecore package downloads (for Azure AppService) you’ll see the following:
<field fieldName="__is_running" cloudFieldName="is_running____" boost="1f" type="System.Boolean" settingType="Sitecore.ContentSearch.Azure.CloudSearchFieldConfiguration, Sitecore.ContentSearch.Azure" />
This code needs to change to the following (I recommend patching it to avoid any future deployment/upgrade issues):
<field fieldName="__is running" cloudFieldName="is_running_____b" boost="1f" type="System.Boolean" settingType="Sitecore.ContentSearch.Azure.CloudSearchFieldConfiguration, Sitecore.ContentSearch.Azure" />
The changes are subtle, but important! Firstly, it’s referencing the field name correctly (with a space). Secondly it is giving the index field name a _b suffix to further indicate it is a boolean.
After making this change and then rebuilding the [sitecore-testing-index] in the control panel, marketers and analytics teams rejoiced as they were able to view all of their glorious active tests.