Another fix for Catch FileNotFound exceptions in ExamineBackedMedia which are thrown by Examine currently (bug?) on a LoadBalanced file store after a publish occurs. When caught, ExamineBackedMedia will fall back to GetMedia as if the media item wasn't in the examine index

This commit is contained in:
agrath
2011-07-28 09:44:23 -12:00
parent 4cbd06dad9
commit 3a7609cba0

View File

@@ -302,17 +302,26 @@ namespace umbraco.MacroEngines
}
private static List<ExamineBackedMedia> GetChildrenMedia(int ParentId)
{
//first check in Examine as this is WAY faster
var criteria = ExamineManager.Instance
.SearchProviderCollection["InternalSearcher"]
.CreateSearchCriteria("media");
var filter = criteria.ParentId(ParentId);
var results = ExamineManager
.Instance.SearchProviderCollection["InternalSearcher"]
.Search(filter.Compile());
if (results.Any())
try
{
return results.ToList().ConvertAll(result => new ExamineBackedMedia(result));
//first check in Examine as this is WAY faster
var criteria = ExamineManager.Instance
.SearchProviderCollection["InternalSearcher"]
.CreateSearchCriteria("media");
var filter = criteria.ParentId(ParentId);
var results = ExamineManager
.Instance.SearchProviderCollection["InternalSearcher"]
.Search(filter.Compile());
if (results.Any())
{
return results.ToList().ConvertAll(result => new ExamineBackedMedia(result));
}
}
catch (FileNotFoundException)
{
//Currently examine is throwing FileNotFound exceptions when we have a loadbalanced filestore and a node is published in umbraco
//See this thread: http://examine.cdodeplex.com/discussions/264341
//Catch the exception here for the time being, and just fallback to GetMedia
}
var media = umbraco.library.GetMedia(ParentId, true);