Integrate Apache Solr with Sitecore 10.4 using Managed Search
Overview
The SearchStax Managed Search service can be used to enable Apache Solr on a Sitecore 10.4 website.
This page demonstrates how to connect Sitecore to a Managed Search cluster. SearchStax has created a PowerShell 7 script that automates the steps of preparing Solr for Sitecore integration. This script is available to SearchStax clients free of charge from our Github site.
Contents:
- Sitecore 10.4
- Create a New Deployment in Managed Search.
- Run the Managed Search Connector for Sitecore.
- Set the Sitecore/Solr Connection String
- Populate Schema from the Control Panel in Sitecore.
- Problems?
Sitecore 10.4
This page assumes that you have already installed Sitecore per Sitecore’s documentation and that you have access to the Sitecore Content Management Server.
You’ll need access to the Sitecore Control Panel to be able to edit the Sitecore Configuration files and Connection Strings.
Installation guides for a number of architectures for all versions of Sitecore can be found here: https://doc.sitecore.com/xp/en/developers/installation-and-upgrade-guides/index.html
Create a New Deployment in Managed Search
Assuming you have already created a SearchStax account and do not already have a deployment set up, click on the Dedicated Infrastructure tab and then click on the Create Deployment button at the top. Enter a deployment name, and select the most appropriate provider, region, plan, and Solr version (See the Sitecore/Solr Compatibility section below).
![](https://www.searchstax.com/docs/wp-content/uploads/2023/02/image-3.png)
Cloud Provider
A self-managed Sitecore project may use any of our cloud providers for the Solr deployment.
Single Node or Cluster
Sitecore will work with a single-node deployment (the “NDN” series of Managed Search deployments) for purposes of testing and evaluation. However, a production system requires a Managed Search cluster (the “NDC” series) to provide high-availability and failover features.
Sitecore/Solr Compatibility
Sitecore 10.4 is known to be compatible with Solr 8.11.2. Other combinations may or may not work. See Sitecore’s Solr Compatibility Table for further information.
Once you create your deployment, you will see it in the Solr Deployments dashboard.
![](https://www.searchstax.com/docs/wp-content/uploads/2023/02/image-4-1024x260.png)
Clicking on the name of the deployment gives you pertinent information about your deployment’s servers. The Solr HTTP Endpoint takes you to your Solr server dashboard.
Secure Zookeeper with an IP Filter
The first step for all new Managed Search deployments is to whitelist the Sitecore computer with an IP Filter. Sitecore will be unable to connect to Solr without it.
Run the Managed Search Connector for Sitecore
This script is used to connect a Sitecore XP0 installation to a SearchStax Solr instance.
Run the Managed Search Connector for Sitecore on the Sitecore Computer
The Managed Search Connector for Sitecore must be run on the same Windows computer as your Sitecore instance.
Account Owner, Admin, or Technical Contact
To run the Managed Search Connector for Sitecore , you must be the account Owner, an account Admin, or a Technical Contact. See SearchStax User Roles.
The script automates the following parts of the procedure:
- Upload the Solr config files to Solr
- Create the Sitecore collections in Solr
- Configure Sitecore files
Download the Connector
The first step is to visit the SearchStax Github site and download the latest Managed Search Connector for Sitecore zip file.
Unzip the file to a convenient location. This creates the searchstax-cloud-connector-for-sitecore-x.y directory.
Install PowerShell 7 and Yaml Module
PowerShell 7 has special capabilities that are required by the Managed Search Connector for Sitecore.
We assume you are on a Windows 10 computer. Open your native PowerShell, and install PowerShell 7 using the following command:
Windows PowerShell:
> iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"
Exit native Powershell and start Powershell 7 as the Administrator. Now install the powershell-yaml module:
Windows PowerShell 7:
> Install-Module powershell-yaml
Edit Connector Configuration
Edit the config.yml file in the searchstax-cloud-connector-for-sitecore-x.y directory. The entries take the form shown below. The connector will ignore any values that it doesn’t need as determined by the configurationMode value. Note the required indentation, which is two spaces under the “settings” header. Parameters under switchOnRebuild and customIndexes must be four spaces.
settings:
accountName: "Example"
deploymentUid: "ss123456"
sitecorePrefix: "sitecore"
solrUsername: ""
solrPassword: ""
sitecoreVersion : "10.4.0"
isUniqueConfigs: "true"
configurationMode: "XP"
isSxa: "false"
switchOnRebuild:
enableForPlatformIndexes: "false"
enableForMarketingIndexes: "false"
enableForSXA: "false"
sufix: "_rebuild"
mainAlias: "_MainAlias"
rebuildAlias: "_RebuildAlias"
sitecorePrefix: "sitecore"
customIndexes:
# - core: "sitecoreindex-123"
# isSwitchOnRebuild: "false"
# - core: "sitecoreindex-456"
# isSwitchOnRebuild: "false"
Name | Description | Example |
---|---|---|
accountName required string | Name of the SearchStax account, upper right corner of the screen.![]() | “ABCInternational” |
deploymentUid required string | UID of the SearchStax deployment. Look in the deployment URL.![]() | “ss123456” |
sitecorePrefix required for Sitecore XConnectstring | Prefix of the sitecore installation. We advise using the “sitecore” default. Do not use a period (.) in this value, as it causes issues with performance monitoring. | “sitecore” |
pathToWWWRoot required string | Path to wwwroot folder in inetpub, i.e. your %IIS_SITE_HOME% variable. | “C:inetpubwwwroot” |
solrUsername optional string | Solr Basic Auth username | “username” |
solrPassword optional string | Solr Basic Auth password | “password” |
sitecoreVersion required string | Version of Sitecore. Supported versions – 9.0.2, 9.1.1, 9.2.0, 9.3.0, 10.0.0, 10.1.0, 10.1.1, 10.2.0, 10.3.0, 10.4.0 | “10.4.0” |
isUniqueConfigs required for Sitecore string | Switch between one config for all collections (“true”), and a unique config for each (“false”). When isUniqueConfigs is false, the script creates only one set of config files, and use that set for all of the Sitecore collections. The name of the config set is sitecore_<sitecorePrefix>. Example: sitecore_sitecore100. When isUniqueConfigs is true (the default), the script creates a set of config files corresponding to each separate Sitecore collection. This lets Sitecore properly populate the schemas of the various collections. These configsets are named <sitecorePrefix>_<collectionName>. Example: sitecore100_core_index. | “true” |
configurationMode required string | “XM” for setting up Sitecore XM Indexes (the core, master, and web indexes.) “XP” for setting up Sitecore XP Indexes. (XM indexes plus Marketing Definitions, Content Testing, etc.) “XCONNECT” means to set up an xDB index. For “XCONNECT” with Solr versions 6.6.0 to 8.6.2, you’ll need to have SearchStax Support enable configset.upload.enabled before running the connector. | “XP” “XP|XCONNECT” means both at once. |
isSxa required string | “True” will add two additional collections to Solr for SXA support. | “true” or “false” |
switchOnRebuild | Header introducing extended configuration for switch on rebuild. | Has no values. |
enableForPlatformIndexes required string | When “true”, will add additional collections and aliases for Sitecore Platform Indexes (core, master, web, etc.). | “true” or “false” |
enableForMarketingIndexes required string | When “true”, will add additional collections and aliases for Sitecore Platform Marketing Indexes (content testing, fxm, etc). Generally, this will always be false unless a specific use case calls for this configuration. | “true” or “false” |
enableForSXA required string | When “true”, will add additional collections and aliases for Sitecore SXA Indexes. | “true” or “false” |
sufix required string | The suffix of the rebuild collection name. Default: “_rebuild”. Do not use a period (.) in this value, as it causes issues with performance monitoring. | “_rebuild” |
mainAlias required string | The suffix of the Main Alias name. Default: “_MainAlias” | “_MainAlias” |
rebuildAlias required string | The suffix of the Rebuild Alias name. Default: “_RebuildAlias” | “_RebuildAlias” |
sitecorePrefix required string | The prefix of the Rebuild collctions and Aliases. Default: “sitecore”. Do not use a period (.) in this value, as it causes issues with performance monitoring. | “sitecore” |
customIndexes | Header introducing an array of optional custom indexes. | Each subsequent row begins with “-“. There are two parameters per row. |
core required for custom index string | Collection name of the custom index. Do not use a period (.) in this value, as it causes issues with performance monitoring. | “sitecoreindex-456” |
isSwitchOnRebuild required for custom index string | When “true” will create additional rebuild collection and aliases. | “true” or “false” |
Run the Managed Search Connector for Sitecore
From Powershell 7, run as Administrator, navigate to the searchstax-cloud-connector-for-sitecore-x.y directory.
Change the execution policy to skip checking.
Windows Powershell 7:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
Run the sitecore-searchstax-connector.ps1 script.
Windows Powershell 7:
> .sitecore-searchstax-connector.ps1
The script will prompt you for your SearchStax user name and password. The script may take a few minutes to run, during which it will notify you of its actions.
Error: A config with this name already exists!
If you get this error in PowerShell, see our Help Center topic A config with this name already exists!
Set the Sitecore/Solr Connection String
Be sure to also update your Sitecore Solr Connection String for all Sitecore roles including xConnect.
To connect Sitecore to a Solr cloud cluster, check the SitecoreWebSite/App_Config/ConnectionStrings.config file for an entry similar to:
<add name="solr.search" connectionString="<Solr HTTP Endpoint>/solr;solrCloud=true" />
The Solr HTTP Endpoint is on the Deployment Details screen of thee Solr deployment.
The connectionString ends with /solr;solrCloud=true
. There is no /
between /solr
and the semicolon. Sitecore inserts that character automatically.
Populate Schema from the Control Panel in Sitecore
Follow these steps to populate the Solr schema:
- Log in to the Sitecore Content Management environment.
- Open the Sitecore Control Panel.
- In the Indexing tab, click Populate Solr Managed Schema.
- Select all indexes and click Populate. (If you have difficulty populating the schema, see Why does Sitecore fail to populate schemas?)
- On the same page, go to the Indexing Manager, select all, and click Rebuild.
![Sitecore Solr SearchStax schemas](https://www.searchstax.com/docs/wp-content/uploads/2021/03/sitecoreSchemas93.png)
![Sitecore Solr SearchStax schemas](https://www.searchstax.com/docs/wp-content/uploads/2021/03/sitecoreRebuildButton93.png)
Problems?
See Sitecore Connection Errors for a list of the most-common issues that arise when connecting Sitecore to your SolrCloud deployment.
Questions?
Do not hesitate to contact the SearchStax Support Desk.