/// <summary> /// Checks if indexexists. /// </summary> /// <param name="provider">The provider.</param> private ICrmEntityIndexSearcher GetSearcher(SearchProvider provider) { try { return(provider.GetIndexSearcher()); } catch (IndexNotFoundException) { using (var builder = provider.GetIndexBuilder()) { builder.BuildIndex(); return(provider.GetIndexSearcher()); } } }