How I fixed the SolrException “Error opening new searcher”

Sometimes I feel as if computers get emotional. I mean, they get angry and start messing with your work. Also, they start breaking things that weren’t supposed to break. This week, my computer decided to break one of the Solr indexes used by a Sitecore 9 installation.

I got into the same situation as this folk here Solr stopped with Error opening new searcher at org.apache.solr.core.

I noticed that Sitecore Forms stopped to show the forms and templates that I had created (again). I checked the logs and saw the error “Box_Sitecore9_xdd: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Error opening new searcher”.

SolrException Error opening new searcher
Figure 1: SolrException “Error opening new searcher”

From what I could find, it seems to be a bad error message due to a corrupted index. The index corruption might have been caused by a failure during the computer restart process. As I recall, I restarted my computer due to a required Windows update.

To fix that, I did the following:

1. Stopped Solr Service

net stop Solr6

Sitecore 9 requires you to install Solr and configure it to run as a Windows service. On top of that, you must enable SSL for Solr. Learn more at Walkthrough: Setting up Solr.

2. Deleted Solr index folders (all of them)

Solr Sitecore Indexes
Figure 2: Solr – Index folders

3. Stopped Sitecore Windows Services

SolrException Sitecore Windows Services
Figure 3: Sitecore 9 – Windows Services

Sitecore Installation Framework install alongside with Sitecore XP 9, the Sitecore Marketing Automation Engine and Sitecore XConnect Search Indexer as a Windows Service for every Sitecore instance.

The Marketing Automation Engine is a stand-alone service that is responsible for enrolling contacts in plans and activities. The xConnect Search Indexer is responsible for adding contact and interaction data to the xDB search index.

4. Run a Powershell Script to re-create all the Solr Indexes

#define parameters
$prefix = "Box_Sitecore9"
$PSScriptRoot = "X:\Sitecore\SIF\Sitecore 9.0.0 rev. 171002"
$SolrUrl = "https://localhost:8989/solr"
$SolrRoot = "X:\Solr"
$SolrService = "Solr6"

#install solr cores for xdb
$solrParams = @{
 Path = "$PSScriptRoot\xconnect-solr.json"
 SolrUrl = $SolrUrl
 SolrRoot = $SolrRoot
 SolrService = $SolrService
 CorePrefix = $prefix
}
Install-SitecoreConfiguration @solrParams

#install solr cores for sitecore
$solrParams = @{
 Path = "$PSScriptRoot\sitecore-solr.json"
 SolrUrl = $SolrUrl
 SolrRoot = $SolrRoot
 SolrService = $SolrService
 CorePrefix = $prefix
}
Install-SitecoreConfiguration @solrParams

5. Started Sitecore Windows Services

The Marketing Automation Engine and the xConnect Search Indexer services need to be started again.

6. Populate Solr Managed Schema

Solr uses a defined schema when it works with documents. You can modify an existing schema with the Populate Solr Managed Schema tool. This tool automatically populates Sitecore fields and makes sure all fields that Sitecore needs are present. Learn more at Solr managed schemas.

In the Sitecore Launchpad, click on Control Panel, and then, in INDEXING group, click on Populate Solr Managed Schema.

Populate Solr Managed Schema
Figure 4: Sitecore 9 – Populate Solr Managed Schema

7. Reindex everything

In the Sitecore Launchpad, click on Control Panel, and then, in INDEXING group, click on Indexing Manager. Select all indexes and rebuild them all.

That fixed the issue for me.

Update

As recommended in the Sitecore 9 – Update 1 documentation, I installed the Solr 6.6.2 and I’ve never had this problem again.

References

  1. sitecore.stackexchange.com. (n.d.). Why I can’t see my forms/templates in the Sitecore Forms application?. [online] Sitecore.stackexchange.com. Available at: https://sitecore.stackexchange.com/questions/8518/why-i-cant-see-my-forms-templates-in-the-sitecore-forms-application [Accessed 3 Dec. 2017].
  2. Community.hortonworks.com. (n.d.). Solr 5.5 Solr Exception Error opening new searcher (NiFi Flow) – Hortonworks. [online] Available at: https://community.hortonworks.com/questions/68865/solr-55-solr-exception-error-opening-new-searcher.html [Accessed 3 Dec. 2017].
  3. Doc.sitecore.net. (2017). Sitecore Documentation: Sitecore Forms. [online] Available at: https://doc.sitecore.net/sitecore_experience_platform/digital_marketing/sitecore_forms [Accessed 3 Dec. 2017].
  4. org.apache.solr.core, S. (n.d.). Solr stopped with Error opening new searcher at org.apache.solr.core. [online] Stackoverflow.com. Available at: https://stackoverflow.com/questions/30747284/solr-stopped-with-error-opening-new-searcher-at-org-apache-solr-core [Accessed 3 Dec. 2017].
  5. Solr.pl. (n.d.). CheckIndex for the rescue « Solr Enterprise Search. [online] Available at: https://solr.pl/en/2011/01/17/checkindex-for-the-rescue/ [Accessed 3 Dec. 2017].
  6. Doc.sitecore.net. (2017). Marketing Automation Engine overview — Sitecore Documentation. [online] Available at: https://doc.sitecore.net/developers/xp/marketing-automation/automation-engine [Accessed 3 Dec. 2017].
  7. Doc.sitecore.net. (2017). Sitecore Documentation: Solr managed schemas. [online] Available at: https://doc.sitecore.net/sitecore_experience_platform/setting_up_and_maintaining/search_and_indexing/solr_managed_schemas [Accessed 3 Dec. 2017].
  8. Doc.sitecore.net. (2017). Sitecore Documentation: Walkthrough: Setting up Solr. [online] Available at: https://doc.sitecore.net/sitecore_experience_platform/setting_up_and_maintaining/search_and_indexing/walkthrough_setting_up_solr [Accessed 3 Dec. 2017].
  9. Doc.sitecore.net. (2017). xConnect Search Indexer overview — Sitecore Documentation. [online] Available at: https://doc.sitecore.net/developers/xp/xconnect/xconnect-search-indexer [Accessed 3 Dec. 2017].
  10. Cover Photo by burak kostak from Pexels https://www.pexels.com/photo/broken-heart-love-sad-14303/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s