Let's Share

My personal place to share knowledge about Sitecore, Powershell, Amazon Web Services and .NET

How to switch Sitecore search provider from Lucene to Solr in one minute.

posted by Robert Senktas   | 21-12-2016


This walkthrough describes how to set up Solr for use with Sitecore in automated way. Manual process is describer on Sitecore documentation portal - link. As you can imagine manual process of renaming about 50 configuration files is time consuming and error prone. Sitecore Automation Module (SAM) could help you automate this process with minimal effort and remove a human factor that can make a mistake

1
Get and install

Sitecore Automation Module is distributed by PowerShell Gallery module sitecore-automation. In PowerShell 5.0 or with PowerShellGet you can install it by this command:
Install-Module Sitecore-Automation
Option '-verbose' helps you to understand what is happening during installation.
Option '-force' helps you to update previously installed version
If command Install-Module not exist in your installation, go to the PowerShell Gallery and update your installation.

2
Import module

In a PowerShell command prompt import the module:
Import-Module Sitecore-Automation


3
Server configuration resources

For each Sitecore release and every update from Sitecore 8.1 and later, there is an Excel spreadsheet that you can download listing all the configuration files available in Sitecore. The configuration files listed in the spreadsheet are located in the Website\App_Config\Include folder.

Server configuration resources on doc.sitecore.net
Orginal spreadsheets are available to download on Sitecore documentation portal Excel spreadsheets was converted by me to CSV files with exaclty the same structure. I just changed the names of the headers by removing spaces and other characters not allower in property name. Download the CSV that lists of all the configuration files that you must enable or disable for each server type.

4
Use Set-SitecoreEnvironment command

To switch Sitecore search provider to SOLR run Set-SitecoreEnvironment command from sitecore-automation module:
The script does three things:

  • Backup the whole App_Config\Include folder
  • Disables all Lucene configuration files
  • Enables all Lucene configuration files


Sitecore Powershell SOLR
Comments
This is a personal blog. All opinions here are my own opinions and do not represent my employer’s view in anyway.

Sitecore Automation Module