diff --git a/Composite/Data/Types/PageServices.cs b/Composite/Data/Types/PageServices.cs index e0da7c8dc..4d58f1afc 100644 --- a/Composite/Data/Types/PageServices.cs +++ b/Composite/Data/Types/PageServices.cs @@ -564,7 +564,15 @@ public static void AddPageTypeRelatedData(IPage page) /// /// Deletes the versions of the given page in its current localization scope. /// - public static void DeletePage(IPage page, bool deleteChildPages = true) + public static void DeletePage(IPage page) + { + DeletePage(page, true); + } + + /// + /// Deletes the versions of the given page in its current localization scope. + /// + public static void DeletePage(IPage page, bool deleteChildPages) { using (var transactionScope = TransactionsFacade.CreateNewScope()) { @@ -644,8 +652,19 @@ private static void RemoveAllFolderAndMetaDataDefinitions(IPage page) /// /// /// - /// default is true - public static void DeletePage(Guid pageId, Guid versionId, CultureInfo locale, bool deleteChildPages = true) + public static void DeletePage(Guid pageId, Guid versionId, CultureInfo locale) + { + DeletePage(pageId, versionId, locale, true); + } + + /// + /// Delete the specific version of the page in the current localization scope. + /// + /// + /// + /// + /// + public static void DeletePage(Guid pageId, Guid versionId, CultureInfo locale, bool deleteChildPages) { Verify.ArgumentNotNull(locale, nameof(locale)); diff --git a/Composite/Search/Crawling/SearchDocumentBuilder.cs b/Composite/Search/Crawling/SearchDocumentBuilder.cs index 3898665a7..b314d41a4 100644 --- a/Composite/Search/Crawling/SearchDocumentBuilder.cs +++ b/Composite/Search/Crawling/SearchDocumentBuilder.cs @@ -265,8 +265,23 @@ private void AddAccessField(EntityToken entityToken) internal static string GetEntityTokenHash(EntityToken entityToken) { - var entityTokenString = EntityTokenSerializer.Serialize(entityToken); - var md5Hash = HashingHelper.ComputeMD5Hash(entityTokenString, Encoding.UTF8); + var token = new StringBuilder(); + if (entityToken is DataEntityToken dataEntityToken && typeof(IVersioned).IsAssignableFrom(dataEntityToken.InterfaceType)) + { + var dataSourceId = dataEntityToken.DataSourceId; + // Serialize without versionId + token.Append(dataEntityToken.Id); + token.Append(':'); + token.Append(dataSourceId.LocaleScope); + token.Append(":"); + token.Append(dataSourceId.DataScopeIdentifier); + } + else + { + token.Append(EntityTokenSerializer.Serialize(entityToken)); + } + + var md5Hash = HashingHelper.ComputeMD5Hash(token.ToString(), Encoding.UTF8); return UrlUtils.CompressGuid(md5Hash); }