Sitecore and Solr — How to Add Custom Indexes to Sitecore using SearchStax


Overview

SearchStax® Managed Solr can be used to add custom indexes on a Sitecore website.

This page presumes that you have already installed Sitecore and connected it to a Managed Solr deployment according to the directions for Sitecore 9.1, Sitecore 9.2, Sitecore 9.3, or Sitecore 10.

Therefore, you already have a Sitecore site that is connected to a compatible Managed Solr deployment. You have access to the Solr Dashboard, and you have prepared Solr configuration files for your custom collections, including a custom Managed Schema file.

Contents:

  1. Install the Zookeeper Script
  2. Upload the Sitecore Configuration Files.
  3. Create Sitecore Collections.

Install the Zookeeper Script

Apache ZooKeeper is a centralized service for maintaining configuration information. In a Managed Solr deployment, Zookeeper acts as a centralized repository for your Solr configuration files.

SearchStax users do not have direct access to the Zookeeper configsets as they would in a local Solr installation. Instead, they interact with Zookeeper through a modified version of Solr’s standard zkcli script. SearchStax provides both Linux and Windows versions of the script.

You can download the zkcli ZIP file here: searchstax-client-master.zip.

Unzip the file. The top-level directory is \searchstax-client-master. Navigate to the solr-5, solr-6, solr-7, or solr-8 scripts subdirectory (such as \searchstax-client-master\solr-8\scripts). Locate zkcli.bat in that directory. This is the Windows version of the script.

SearchStax Client Master

Learn about zkcli

The zkcli script is an all-purpose toolkit for managing Zookeeper on a cloud deployment. See What else can I do with the zkcli script?

Zookeeper Best Practice

For truly secure Zookeeper management, use the SearchStax Zookeeper API. The API’s Zookeeper methods require SearchStax user authentication, and they record entries in the Managed Solr access logs. See How can I secure Zookeeper?for more information.

Upload the Sitecore Configuration Files

We assume that you have a directory of configuration files prepared for your custom Sitecore collection.

Follow these steps to upload the Solr configuration for your new collection:

  1. Open the solrconfig.xml file. Set the update.autoCreateFields setting to false (update.autoCreateFields:false).
  2. Open the managed-schema file in the conf folder and do the following:
    1. Set the value in <uniqueKey>id</uniqueKey> to _uniqueid.
    2. In the fields section, add the following field configuration for _uniqueid: <field name=”_uniqueid” type=”string” indexed=”true” required=”true” stored=”true”/>
  3. Use the zkcli.bat script to run this command: zkcli.bat -zkhost <zookeeper URLs> -cmd upconfig -d <config_directory> -n <config_name> where <config_directory> is the local custom configuration directory, <config_name> will be the name of the custom configuration on Zookeeper, and <zookeeper URLs> corresponds to the URL of the Zookeeper ensemble in the deployment details page:SearchStax Sitecore Solr
  4. From the deployment details page, click the Solr HTTP Endpoint link to open the Solr Dashboard. Verify that the directory structure of <config_name> is similar to that shown below.SearchStax Sitecore Solr

Create Sitecore Collections

Pay attention to ReplicationFactor

Use replicationFactor=1 for a single-node deployment. A two-node cluster should have replicationFactor=2. You need the same number of replicas as Solr servers.

When you have uploaded the Solr configuration to Zookeeper, you can create Sitecore collections by following these steps:

  1. Navigate to the Collections page in the Solr Dashboard.
  2. Click Add Collection.
  3. In the config set field, click the Sitecore configuration.
  4. Specify the following fields as shown:SearchStax Sitecore Solr
  5. Repeat for each of the custom collections you wish to add.

Questions?

Do not hesitate to contact the SearchStax Support Desk.

Was this article helpful?
YesNo