Configure the Solr search provider

Current version: 10.1

This topic describes how to configure the Solr search provider manually. It is assumed that you have already installed Solr.

Solr is the default search engine for xConnect search for on-premise installations.

Note

The Sitecore Experience Platform is secure by default. You must therefore enable SSL for Solr.

Create Solr cores

To create new Solr cores:

  1. Make 2 copies of Solr _default configurations from the C:\solr-8.1.1\server\solr\configset\_default folder. Put the copies in the C:\solr-8.1.1\server\solr folder.

  2. Rename the cores <custom_name> and <custom_name>_rebuild, for example:

    • xdbcore

    • xdbcore_rebuild

      Important

      You must name one of the cores <custom_name>_rebuild.

  3. Open the Solr web client (https://localhost:89xx/) and click Core Admin.

  4. Add two new Solr cores.

  5. Use the Solr Schema API to apply schema changes from the xconnect\App_data\solrcommands\schema.json file to both cores.

    This example shows a PowerShell script that uses the Solr Schema API to apply the changes:

    RequestResponse
    $pathToXdbSchemaFile="C:\inetpub\wwwroot\<instance_name>_xconnect\App_Data\solrcommands\schema.json"
    $apiUrl="https://<host>:<port>/solr/<custom_name>/schema"
    
    $requestBody = Get-Content $pathToXdbSchemaFile -Raw 
    Write-Host "Executing Solr commands:" $requestBody 
    
    Write-Host "Solr response:"[
    Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    Invoke-WebRequest -Uri $apiUrl -ContentType "application/json" -Method Post -Body $requestBody | Write-Host
    Note

    If you need to apply the schema changes again, you must delete the copy fields first. You do this with the xconnect\App_data\solrcommands\10.0-or-later-schema-preparation.json file. Solr may return a 404 error if one or more copy fields are not found, which is as expected.

  6. You must specify the solrCore connection string with the name of the core attached to Solr in these configuration files:

    • xconnect\App_Config\ConnectionStrings.config

    • xconnect\App_data\jobs\continuous\IndexWorker\App_config\ConnectionStrings.config

    The node you update looks like this:

    RequestResponse
    <add name="solrCore" connectionString="https://<host>:<port>/solr/<custom_name>"/>

    You must replace <custom_name> with the name you use for the core.

Do you have some feedback for us?

If you have suggestions for improving this article,