xConnect-Only Deployments in the SearchStax Managed Search Connector for Sitecore
People who read my blog posts know I still have a few projects on good old Sitecore XP. This is a post that has been hanging around for a while. Earlier this year I was involved in an upgrade process where we also moved the indexes from Azure Search to Solr. As you probably know Sitecore stopped support for Azure Search completely in 10.2. Although you can host your own Solr instance, there are other options with companies that take away some of the burden and manage that Solr for you. SearchStax is one of them and quite familiar in the Sitecore community. So while setting up the latest Sitecore version for the upgrade (10.4 at that time) we also switched to SearchStax Managed Search.
We bumped into a small issue - and have a fix for it so it's worth sharing. Although I must admit the issue was also caused by something we did wrong - but we're human, so that happens :)
If you are using SearchStax Managed Search (Solr-as-a-Service) with Sitecore XP, the SearchStax Cloud Connector for Sitecore is a huge time-saver. Instead of manually uploading ZooKeeper configs, creating collections, and configuring aliases, the PowerShell script (sitecore-searchstax-connector.ps1) automates the heavy lifting based on a config.yml file. The documentation on this config file is pretty good and it has lots of options to set everything exactly as you need - including custom indexes.
Due to my own mistake, I ran into a scenario where I needed to configure only xConnect indexes —without touching the standard Sitecore XP platform indexes again. Of course, I could remove everything and start all over but according to the SearchStax documentation, this should work out of the box. In practice, however, running the script in XCONNECT-only mode hit a subtle bug.
The configuration modes
In config.yml, the configurationMode setting supports three values:
XP– Sets up the Sitecore platform and marketing indexes only.XCONNECT– Sets up the xDB search indexes (xdb/xdb_rebuild) only.XP|XCONNECT– Sets up both at the same time.
When the script initializes, it check the configurationMode and sets boolean flags to determine later on what to do.
The issue
When I set configurationMode: "XCONNECT", the script failed. Apparently it was unable to resolve the Solr version which of course broke the code in a later phase.
Right after initialization, the script maps sitecoreVersion to the corresponding $solrVersion (for example, 10.0.* → 8.4.0, 10.4.* → 8.11.2). The catch was that this version-mapping logic only lived inside the XP branch and was not executed when this flag was not true.
Which is the case when configurationMode is set strictly to "XCONNECT". As a result, the script skipped the version check and left $solrVersion empty. Even though the script later entered the the code to perform all tasks needed for the xDB indexes, passing an empty $solrVersion broke the execution there.
The Fix
To support XCONNECT-only execution properly, I added an extra block in sitecore-searchstax-connector.ps1 to resolve the solr version in this case:
elseif($global:isConfigureXConnect -eq "true") {
if ($sitecoreVersion -eq "9.0.2") {
$solrVersion = "6"
$global:isUniqueConfigs= $true
} elseif ($sitecoreVersion -eq "9.1.1") {
$solrVersion = "7.2.1"
} elseif ($sitecoreVersion -eq "9.2.0") {
$solrVersion = "7.5.0"
} elseif ($sitecoreVersion -eq "9.3.0") {
$solrVersion = "8.1.1"
} elseif ($sitecoreVersion -like "10.0.*") {
$solrVersion = "8.4.0"
} elseif ($sitecoreVersion -like "10.1.*") {
$solrVersion = "8.4.0"
} elseif ($sitecoreVersion -like "10.2.*") {
$solrVersion = "8.8.2"
} elseif ($sitecoreVersion -like "10.3.*") {
$solrVersion = "8.11.2"
} elseif ($sitecoreVersion -like "10.4.*") {
$solrVersion = "8.11.2"
}
....
}
With $solrVersion populated, running the connector with configurationMode: "XCONNECT" now executes properly, uploading only the xConnect ZooKeeper configuration, creating the xdb collections, wiring up the aliases, and updating the xConnect schema.
When to use...
Being able to run XCONNECT independently is probably not something you regularly do but it can be helpful helpful when you really want to distribute everything - or if you screwed up and you want to redo just the xdb indexes :)
Links
If you need this before it's merged, you can use my updated version or review the the pull request:
- My Fork: Gatogordo/searchstax-cloud-connector-for-sitecore
- Pull Request: searchstax/searchstax-cloud-connector-for-sitecore #55

