Installing Sitecore Experience Accelerator (SXA) is fairly simple. You first install the package for Sitecore PowerShell Extensions (SPE). Then the SXA package…then your done right?…well if you do not follow the installation guide closely, you’ll end up like me after every install with broken features as you never installed and configured the required Solr index cores.
For those lazy and skip reading the instructions, so you miss the step that say go create Solr cores and here’s how, you need this PowerShell script.
I must give recognition where its due, as the core functionality of the script is not my own, but taken from the very helpful Sitecore Habitat Home Utilities. I have added a wrapper script and combined some of the configuration JSON files to hopefully help simplify the usage.
What the Script does
In a nutshell the script will create the required Solr cores for SXA, this will be SXA_Master_Index and SXA_Web_Index. The script has logic to properly append a prefix to the above index names, allowing you to have many SXA sites up and running. (How many is to many is not for me to say.)
After creating the Solr cores, the script will go into you site web root and update the configuration files appropriately to match your prefixed named cores.
Finally, the script sets up the suggester request handler in Solr for the SXA cores.
Enough rambling and onto the the required steps
Copy the following three files to a single location such as C:\sitecoreinstall\sxa-solr.
Open a PowerShell prompt running as Admin.
Change your directory to the folder as created in step 1
- Run the script
- You will be prompted to complete the following required parameters, and then be shown a check list to ensure everything is correct.
- Enter Y or N depending on if you wish to continue with the process
- The script will run and upon completion you should see the following message (or if your unluckly a red message of an error.)
How to Uninstall
For whatever reason you need to delete the SXA Solr cores and reset the configuration files then you’ll want to run launch the script with the UninstallCores flag.
You will then be prompted to enter the required parameters, followed by a confirmation message.
The script will run, and you’ll get a dark green confirmation or a red error message to resolve.