We are planning on changing from Lucene to Solr due to number of items and because we have more than one CM server.

What are the steps needed to migrate default lucene indexes to Solr? Is it just a matter of enabling all .Solr.config files or will we need to do much more than that?

We also have one custom lucene index we use on the site to query items. Is it a massive job to migrate this?

Using Sitecore 8.1


4 Answers 4


As others have said here there are a number of steps to do this:

  1. Install Solr
  2. Generate an XML Schema for Solr
  3. Enable Solr term support
  4. Verify that Solr is running correctly
  5. Create Solr cores
  6. Configure an IOC Container
  7. Configure Sitecore to work with Solr
  8. Rebuild the search Indexes

This official Sitecore documentation covers most of this fairly well: https://doc.sitecore.net/sitecore_experience_platform/80/setting_up__maintaining/search_and_indexing/walkthrough_setting_up_solr

However I'm going to pick up on the more complex/time consuming ones of these and break them down for you.

Install Java, Tomcat & Solr

There are some other ways to do this such as using bitnami, but here is the full manual install process using Apache Tomcat.

  1. Install Java https://java.com/en/download/ (if it isn't already installed - https://www.java.com/en/download/installed.jsp)
  2. Download the Solr 4.1.0 windows zip from http://lucene.apache.org/solr/downloads.html.
  3. Extract the zip and find the \dist folder in the extracted solr-4.1.0 directory. Rename the solr-4.1.0.war to solr.war and copy the file to the Tomcat’s \webapps folder. e.g: C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps.
  4. Create an empty Solr home folder to hold all Solr instances. For example, C:\solr.
  5. Find the \example\solr folder in the extracted solr-4.1.0 directory. Copy the contents of \example\solr to the empty Solr home folder you just created in step
  6. Copy the jar files from \solr-4.1.0\dist to Tomcat’s \lib folder. e.g: C:\Program Files\Apache Software Foundation\Tomcat 8.0\lib.
  7. Set the home directory for Solr in Tomcat. By adding a new Java option with the Monitor Tomcat program. e.g -Dsolr.solr.home=C:\solr
  8. Stop and Restart Tomcat.
  9. Check you new instance of Solr is running by going here: http://localhost:8080/solr
  10. If it isn't running properly check the Catalina logs.

Configure Sitecore to work with Solr

One of the steps that takes the longest is switching all the configs to use Solr. There is a Powershell script below that will do this for you:

    Function Set-SCSearchProvider {
    $rootPath = Read-Host "What is the path of your Sitecore instance's website folder?";
    $choice = Read-Host "(L)ucene or (S)olr?";

    $validInput = $true;
    #test that path is valid
    If (!(Test-Path -Path $rootPath))
        Write-Host "The supplied path was invalid or inaccessible." -ForegroundColor Red;
        $validInput = $false;
    #test that choice is valid
    ElseIf (($choice -ne "L") -and ($choice -ne "S"))
        Write-Host "You must choose L or S." -ForegroundColor Red;
        $validInput = $false;

    If ($validInput)
        If (($choice -eq "L"))
            Write-Host "Set to Lucene." -ForegroundColor Yellow;
            $selectedProvider = "Lucene";
            $deselectedProvider = "Solr";
        ElseIf (($choice -eq "S"))
            Write-Host "Set to Solr." -ForegroundColor Yellow;
            $selectedProvider = "Solr";
            $deselectedProvider = "Lucene";

        #enumerate all config files to be enabled
        $filter = "*" + $selectedProvider + "*.config*";
        $filesToEnable = Get-ChildItem -Recurse -File -Path $rootPath -Filter $filter;
        foreach ($file in $filesToEnable)
            Write-Host $file.Name;
            if (($file.Extension -ne ".config"))
                $newFileName = [io.path]::GetFileNameWithoutExtension($file.FullName);
                $newFile = Rename-Item -Path $file.FullName -NewName $newFileName -PassThru;
                Write-Host "-> " $newFile.Name -ForegroundColor Green;

        #enumerate all config files to be disabled
        $filter = "*" + $deselectedProvider + "*.config*";
        $filesToDisable = Get-ChildItem -Recurse -File -Path $rootPath -Filter $filter;
        foreach ($file in $filesToDisable)
            Write-Host $file.Name;
            if ($file.Extension -eq ".config")
                $newFileName = $file.Name + ".disabled";
                $newFile = Rename-Item -Path $file.FullName -NewName $newFileName -PassThru;
                Write-Host "-> " $newFile.Name -ForegroundColor Green;
    } }


Originally from here: https://gist.github.com/patrickperrone/59b8745ee8b8ff9045b5

This is a really quick way of renaming your configs. We use this during deployments also from Octopus.

There is a great guide for more info on setting up Solr here: https://sitecore-community.github.io/docs/search/solr/fast-track-solr-for-lazy-developers/

With regard to your custom index. Migrating the index to Solr should work but as mentioned above it depends on the kind of queries you are doing, you may need to refactor some of your code/config after migration. We have 3 or 4 custom Solr indexes and they work fine.


It depends on your solution, but there are some other steps that you might need to take. I recently did the same and, we had to:

  • do the standard solr setup (install, create cores, disable Lucene.config and enable Solr.config files, ...)
  • make solr work with Autofac4, which was already in the project
  • update all custom index configs (there were quite some changes here)
  • rewrite some queries as some fields had changed in the custom configs (due to the fact that Solr seemed to handle them differently)
  • as some characters were escaped wrongly, write an escape function (and call support who have a patch now - ref. nr. 131992)
  • rewrite another query which had performance issues now (the query had to return a lot of results and that went smoother on our Lucene somehow)

Planning on writing a blog on the experience, but didn't find the time yet.

So it might be some more work, but it could go all smoothly.


To enable Solr for Sitecore, you'll need to perform the following steps:

  1. Install the correct version of Solr for your version of Sitecore
  2. Modify the default Solr schema file using the Sitecore schema tool. (You may also need to make manual changes here, too.)
  3. Enable Solr term support
  4. Configure an IOC container, if needed. (Recent versions of Sitecore have a default IOC container included already)
  5. Disable all the Lucene config files for Solr files instead
  6. Rebuild you indexes

Sitecore now has several documentation articles posted online for Lucene to Solr conversion. There are also lots of other blog posts describing the process. See:


Just wanted to add to this discussion by posting that I wrote a little PowerShell to help you with adding the cores via the API. Makes it a lot easier that adding each one, one by one. You can edit the path to the cores and data files in the script.


function Add-Core([string]$coreName)
    try {$request = "http://localhost:8983/solr/admin/cores?action=CREATE&name={0}&instanceDir=C:\Bitnami\solr-5.4.1-0\apache-solr\solr\{0}&config=solrconfig.xml&schema=schema.xml&dataDir=data" -f $coreName} catch {}
    echo $request 

    $response = Invoke-RestMethod $request

$cores = @(

 foreach ($core in $cores) {
   Add-Core -coreName $core
  • `instanceDir=C:\Bitnami\solr-5.4.1-0\apache-solr\solr` if my instance is running on Docker what goes in the instanceDir parameter?
    – phani
    Commented Dec 22, 2016 at 11:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.