mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-01-19 09:42:29 +08:00
This commit is contained in:
@@ -160,6 +160,9 @@ namespace Orchard.Indexing.Services {
|
||||
.OrderBy(versionRecord => versionRecord.Id)
|
||||
.Take(ContentItemsPerLoop)
|
||||
.ToList()
|
||||
// In some rare cases a ContentItemRecord without a ContentType can end up in the DB.
|
||||
// We need to filter out such records, otherwise they will crash the ContentManager.
|
||||
.Where(x => x.ContentItemRecord != null && x.ContentItemRecord.ContentType != null)
|
||||
.Select(versionRecord => _contentManager.Get(versionRecord.ContentItemRecord.Id, VersionOptions.VersionRecord(versionRecord.Id)))
|
||||
.Distinct()
|
||||
.ToList();
|
||||
@@ -220,6 +223,9 @@ namespace Orchard.Indexing.Services {
|
||||
.OrderBy(x => x.Id)
|
||||
.Take(ContentItemsPerLoop)
|
||||
.ToList()
|
||||
// In some rare cases a ContentItemRecord without a ContentType can end up in the DB.
|
||||
// We need to filter out such records, otherwise they will crash the ContentManager.
|
||||
.Where(x => x.ContentItemRecord != null && x.ContentItemRecord.ContentType != null)
|
||||
.GroupBy(x => x.ContentItemRecord.Id)
|
||||
.Select(group => new { TaskId = group.Max(task => task.Id), Delete = group.Last().Action == IndexingTaskRecord.Delete, Id = group.Key, ContentItem = _contentManager.Get(group.Key, VersionOptions.Latest) })
|
||||
.OrderBy(x => x.TaskId)
|
||||
|
||||
Reference in New Issue
Block a user