Fix bug field index part handler (#8294)

This commit is contained in:
ElenaRepository 2019-12-05 21:04:56 +01:00 committed by Sébastien Ros
parent 70c4541977
commit a67b3cfa00

View File

@ -48,7 +48,10 @@ namespace Orchard.Projections.Handlers {
}
}
private void Updated(UpdateContentContext context, FieldIndexPart fieldIndexPart) {
if (context.UpdatingItemVersionRecord.Latest) { // updates projection draft indexes only if it is the latest version
// there are two different item types: saved in memory and saved to db
// those saved in memory don't have correctly the populated record and this generate NullReferenceException
if (context.UpdatingItemVersionRecord != null && context.UpdatingItemVersionRecord.Latest) {
// updates projection draft indexes only if it is the latest version
DescribeValuesToindex(fieldIndexPart, (indexServiceContext) => {
_draftFieldIndexService.Set(fieldIndexPart,
indexServiceContext.LocalPart.PartDefinition.Name,
@ -113,4 +116,4 @@ namespace Orchard.Projections.Handlers {
}
}
}
}