internal static void HydrateDefaultFields(this JToken content, FieldConfig indexConfig) { if (indexConfig.HasField(AppConfig.FieldNamePublishStartDate) && !content.HasField(AppConfig.FieldNamePublishStartDate)) { content[AppConfig.FieldNamePublishStartDate] = DateTime.MinValue; } if (indexConfig.HasField(AppConfig.FieldNamePublishEndDate) && !content.HasField(AppConfig.FieldNamePublishEndDate)) { content[AppConfig.FieldNamePublishEndDate] = DateTime.MaxValue; } if (indexConfig.HasField(AppConfig.FieldNamePublishStatus) && !content.HasField(AppConfig.FieldNamePublishStatus)) { content[AppConfig.FieldNamePublishStatus] = "published"; } }
public static void HydrateDefaultFields(this OpenContentInfo content, FieldConfig indexConfig) { if (indexConfig.HasField(AppConfig.FieldNamePublishStartDate) && content.JsonAsJToken != null && content.JsonAsJToken[AppConfig.FieldNamePublishStartDate] == null) { content.JsonAsJToken[AppConfig.FieldNamePublishStartDate] = DateTime.MinValue; } if (indexConfig.HasField(AppConfig.FieldNamePublishEndDate) && content.JsonAsJToken != null && content.JsonAsJToken[AppConfig.FieldNamePublishEndDate] == null) { content.JsonAsJToken[AppConfig.FieldNamePublishEndDate] = DateTime.MaxValue; } if (indexConfig.HasField(AppConfig.FieldNamePublishStatus) && content.JsonAsJToken != null && content.JsonAsJToken[AppConfig.FieldNamePublishStatus] == null) { content.JsonAsJToken[AppConfig.FieldNamePublishStatus] = "published"; } }