1

I got a scenario where solr connections are working fine in Sitecore CMS where it is giving some issue in Content Delivery. We have defensive code in place where we check if sitecore content indexing search returns null we get it from CMS. Now Is there a way in configuration where we can just set search enabled =false or something which can stop referring to solr server.

2
  • did you installed patch for SOLR to not crash your site if Solr is down ? Apr 27, 2017 at 8:41
  • Is this patch related to sitecore 8.2.1? Apr 28, 2017 at 5:18

2 Answers 2

1

I don't know of any way to turn off search that has already been configured through the proper configs. You could just do something like this in your search queries and turn them on and off in Sitecore or an settings config.

using (var context = ContentSearchManager.GetIndex("sitecore_web_index").CreateSearchContext())
{
     var searchOn = true; // pull this from Sitecore or Setting

     var query = context.GetQueryable<SearchResultItemBase>()
                .Where(item => item.Path.StartsWith(startPath)
                               && true == searchOn);
}
2
  • This is will be taken care when it tries to search but during application start it tries to connect to solr end point and it throws error connection failed. I want to tackle this scenario. Like for mongo we have something like this <setting name="Xdb.Enabled" value="true" /> Apr 27, 2017 at 4:20
  • Kind of like this circuit breaker for Geo Ip. redmoon.london/… I have never does it for search, but maybe that article will help.
    – Chris Auer
    Apr 27, 2017 at 4:59
1

I would try to disable search configuration files. You can see the complete list here.

Another quick option is to patch InitializeSolrProvider processor:

<patch:instead="*[@type='Sitecore.ContentSearch.SolrProvider.Pipelines.Loader.InitializeSolrProvider, Sitecore.ContentSearch.SolrProvider']" />
1
  • You mean only solr configuration or all the configuration listed for search? I will give a try for InitializeSolrProvider for now. Thanks May 1, 2017 at 3:52

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.