Integrate Apache Solr with Sitecore 9.0 using Managed Search


Overview

The SearchStax Managed Search service can enable Apache Solr on a Sitecore 9.0 website.

This page demonstrates how easy it is to connect Sitecore to a SearchStax Solr 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:

  1. Install Sitecore 9.0 without Solr
  2. Create a New Deployment in SearchStax.
  3. Run the Managed Search Connector for Sitecore.
  4. Populate Schema from the Control Panel in Sitecore.
  5. Problems?

1. Install Sitecore 9.0 without Solr

Windows 8 Required

Note that a stand-alone installation of Sitecore 9.0 requires a Windows 8 (or later) computer. Other prerequisites may be found in the Sitecore installation documents.

Sitecore Optimization

When using Solr as the search provider for Sitecore, there are a variety of Sitecore settings that can be tuned to improve performance. See Performance Optimizations when using Solr.

This section describes how to install Sitecore 9.0 locally without Solr. We’ll connect it to a SearchStax Solr deployment in a subsequent step.

  1. Visit the Sitecore Experience Platform 9.0 Initial Release page. Under Download Options for On Premises Deployment, download Packages for XP Single.
SearchStax Solr Sitecore 9.0 download

Farther down the same web page, under Release Information, download the Installation Guide.

SearchStax Solr Sitecore 9.0 release

With the exception of Solr, install all the prerequisite sub-components as mentioned in the installation guide. Make the following changes in the configuration files.

  1. install.ps1: Set the $Prefix to “sitecore” in your install script.
SearchStax Solr Sitecore 9.0

Comment out the Solr root and service details in the install script:

SearchStax Solr Sitecore 9.0

sitecore-XP0.json: Comment out or remove the UpdateSolrSchema task:

SearchStax Solr Sitecore 9.0

c. xconnect-xp0.json: Comment out or remove the ConfigureSolrSchemas task.

SearchStax Solr Sitecore 9.0
  1. Once all the above changes have been made, go ahead with the Sitecore installation by running your PowerShell install script .\install.ps1 as recommended in the Sitecore installation guide.

2. Create a New Deployment in SearchStax

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 for your needs.

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 “DN” series of SearchStax deployments) for purposes of testing and evaluation. However, a production system requires a SearchStax cluster (the “DC” series) to provide high-availability and failover features.

Sitecore/Solr Compatibility

Sitecore 9.0 is known to be compatible with Solr 6.6.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.

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 SearchStax Solr Cloud deployments is to whitelist the Sitecore computer with an IP Filter. Sitecore will be unable to connect to Solr without it.

3. Run the Managed Search Connector for Sitecore

This script is used to connect a Sitecore XP0 installation to a SearchStax Solr instance.

Run the Connector 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 the native version of PowerShell, and install PowerShell 7 (or later) using the following command:

Windows PowerShell:

> iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"

Exit the 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. Enter the following configuration parameters:

settings:
  accountName: "SearchStaxAccount"
  deploymentUid: "ss123456"
  sitecorePrefix: "sitecore"
  pathToWWWRoot: "C:\\inetpub\\wwwroot"
  solrUsername: ""
  solrPassword: ""
  sitecoreVersion : "9.0.2" #Supported versions - 9.0.2 and 9.1.1
  isUniqueConfigs : "true"

 

NameDescriptionExample
accountNameName of the SearchStax account, upper right corner of the screen.
ABCInternational
deploymentUidUID of the SearchStax deployment. Look in the deployment URL.
ss123456
sitecorePrefixPrefix of the sitecore installation. We advise you to use the default “sitecore” value. Do not use a period (.) in this value, as it causes issues with performance monitoring.sitecore
pathToWWWRootPath to wwwroot folder in inetpub, i.e. your %IIS_SITE_HOME% variableC:\inetpub\wwwroot
solrUsernameSolr Basic Auth username(Optional)
solrPasswordSolr Basic Auth password(Optional)
sitecoreVersionVersion of Sitecore (9.0.2 or 9.1.1)9.0.2
isUniqueConfigsSwitch between one config for all collections, and a unique config for each. (See below.)“true”

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_sitecore930.

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: sitecore930_core_index.

In Sitecore 9.0, the connector overrides the isUniqueConfigs setting to always be true. The false setting breaks Sitecore in version 9.0.

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.

4. Populate Schema from the Control Panel in Sitecore

Follow these steps to populate the Solr schema:

  1. Log in to the Sitecore Content Management environment.
  2. Open the Sitecore Control Panel.
  3. In the Indexing tab, click Populate Solr Managed Schema.
  4. Select all indexes and click Populate.
  5. On the same page, go to the Indexing Manager, select all, and click Rebuild.
SearchStax Solr Sitecore 9.0 schema
SearchStax Solr Sitecore 9.0 rebuild

5. Problems?

See Sitecore Problems with SolrCloud 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.