Sitecore Quicktip: Could not find configuration node may be a Solr issue
Came across an interesting issue today in that we kept getting the following error on a page driven by Solr results and a custom database. It kept reporting:
Could not find configuration node: databases/database[@id='web']
Sitecore.Configuration.DefaultFactory.GetConfigNode(String xpath, Boolean assert) +543
Sitecore.Configuration.DefaultFactory.CreateObject(String configPath, String[] parameters, Boolean assert) +187
Sitecore.Configuration.DefaultFactory.GetDatabase(String name, Boolean assert) +157
Sitecore.Configuration.DefaultFactory.GetDatabase(String name) +55
Sitecore.ContentSearch.SearchTypes.SearchResultItem.GetItem() +139
On the surface, this looks like a missing database but this page is driven by a Solr index with a custom database that is not named “web”. However, upon closer inspection we found the following:
- Our SwitchOnRebuild File for the CD configuration had the correct index name and custom database name
- Our SwitchOnRebuild File for the CM configuration had the correct index name… but the database name was still “web”!!!
This meant that when we rebuilt Solr indexes, it was creating the index from the “web” database context and not our custom database. This matters as when the CD Solr configuration went looking for its data, the actual Solr data when we queried an index built from the CM configuration had it listed as web and not our custom database.
"listing_page_hide_filter_b":false,
"__created_by_s":"sitecore\\Admin",
"_database":"web",
Lesson Learned: If your database name in your CD SwitchOnRebuild configuration does not match what is put into Solr by the CM SwitchOnRebuild configuration you may experience the “Could not find configuration node” error.