Thursday, 1 June 2023

How to fix Solr downtime issue

Recently I came across a scenario, where solr was down. And because of that Issue - all page which using solr logic related component having issue.


Solr down time issue might occur because of

  • Index got deleted
  • JVM full
  • Solr service stopped
  • Solr server having issue

To avoid such issue in future, most of the projects used base class for Search related logic. Please make sure try-catch mechanism applied.


try

{

using (var context = searchIndex.CreateSearchContext())

{   

  var queryable = context.GetQueryable<S>();

         //search logic   

          var results = queryable.GetResults();

          if (results == null) 

return new S[] { };

  return results.ToList();

}

}

catch (Exception e)

{

Log.Error(e.Message, e, this);

return new S[] { };

}

No comments:

Post a Comment