From 0343b302f35a5949ee150ceb8dc744706ea206d0 Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 28 Jan 2020 16:37:55 +1100 Subject: [PATCH] Moving stuff to Examine2 (temp name) as a netstandard project, updates to latest Examine netstandard, moves constants to separate class. --- src/Umbraco.Examine/ContentValueSetBuilder.cs | 10 +++---- .../ContentValueSetValidator.cs | 6 ++-- src/Umbraco.Examine/ExamineExtensions.cs | 1 - src/Umbraco.Examine/MediaValueSetBuilder.cs | 4 +-- src/Umbraco.Examine/Umbraco.Examine.csproj | 30 ++++--------------- src/Umbraco.Examine/UmbracoContentIndex.cs | 4 +-- src/Umbraco.Examine/UmbracoExamineIndex.cs | 22 ++++---------- .../UmbracoFieldDefinitionCollection.cs | 10 +++---- .../BaseValueSetBuilder.cs | 0 .../ContentIndexPopulator.cs | 1 - .../IContentValueSetBuilder.cs | 0 .../IContentValueSetValidator.cs | 0 .../IIndexCreator.cs | 0 .../IIndexDiagnostics.cs | 0 .../IIndexPopulator.cs | 0 .../IPublishedContentValueSetBuilder.cs | 0 .../IUmbracoContentIndex.cs | 0 .../IUmbracoIndex.cs | 0 .../IUmbracoIndexConfig.cs | 0 .../IUmbracoMemberIndex.cs | 0 .../IValueSetBuilder.cs | 0 .../IndexPopulator.cs | 0 .../IndexRebuilder.cs | 0 .../IndexTypes.cs | 0 .../MediaIndexPopulator.cs | 1 - .../MemberIndexPopulator.cs | 1 - .../MemberValueSetBuilder.cs | 2 +- .../MemberValueSetValidator.cs | 2 +- src/Umbraco.Examine2/Umbraco.Examine2.csproj | 16 ++++++++++ .../UmbracoExamineFieldNames.cs | 23 ++++++++++++++ .../ValueSetValidator.cs | 4 +-- .../DictionaryPublishedContent.cs | 6 ++-- .../PublishedMediaCache.cs | 8 ++--- src/Umbraco.Tests/Umbraco.Tests.csproj | 6 +++- src/Umbraco.Tests/UmbracoExamine/IndexTest.cs | 14 ++++----- .../UmbracoContentValueSetValidatorTests.cs | 26 ++++++++-------- .../Web/PublishedContentQueryTests.cs | 6 ++-- src/Umbraco.Web/ExamineExtensions.cs | 2 +- .../Models/Mapping/EntityMapDefinition.cs | 20 ++++++------- .../GridPropertyIndexValueFactory.cs | 2 +- .../PropertyEditors/RichTextPropertyEditor.cs | 2 +- src/Umbraco.Web/PublishedContentExtensions.cs | 2 +- src/Umbraco.Web/PublishedContentQuery.cs | 2 +- src/Umbraco.Web/Search/UmbracoTreeSearcher.cs | 8 ++--- .../Search/UmbracoTreeSearcherFields.cs | 2 +- src/Umbraco.Web/Umbraco.Web.csproj | 8 +++-- src/umbraco.sln | 17 +++++++---- 47 files changed, 142 insertions(+), 126 deletions(-) rename src/{Umbraco.Examine => Umbraco.Examine2}/BaseValueSetBuilder.cs (100%) rename src/{Umbraco.Examine => Umbraco.Examine2}/ContentIndexPopulator.cs (98%) rename src/{Umbraco.Examine => Umbraco.Examine2}/IContentValueSetBuilder.cs (100%) rename src/{Umbraco.Examine => Umbraco.Examine2}/IContentValueSetValidator.cs (100%) rename src/{Umbraco.Examine => Umbraco.Examine2}/IIndexCreator.cs (100%) rename src/{Umbraco.Examine => Umbraco.Examine2}/IIndexDiagnostics.cs (100%) rename src/{Umbraco.Examine => Umbraco.Examine2}/IIndexPopulator.cs (100%) rename src/{Umbraco.Examine => Umbraco.Examine2}/IPublishedContentValueSetBuilder.cs (100%) rename src/{Umbraco.Examine => Umbraco.Examine2}/IUmbracoContentIndex.cs (100%) rename src/{Umbraco.Examine => Umbraco.Examine2}/IUmbracoIndex.cs (100%) rename src/{Umbraco.Examine => Umbraco.Examine2}/IUmbracoIndexConfig.cs (100%) rename src/{Umbraco.Examine => Umbraco.Examine2}/IUmbracoMemberIndex.cs (100%) rename src/{Umbraco.Examine => Umbraco.Examine2}/IValueSetBuilder.cs (100%) rename src/{Umbraco.Examine => Umbraco.Examine2}/IndexPopulator.cs (100%) rename src/{Umbraco.Examine => Umbraco.Examine2}/IndexRebuilder.cs (100%) rename src/{Umbraco.Examine => Umbraco.Examine2}/IndexTypes.cs (100%) rename src/{Umbraco.Examine => Umbraco.Examine2}/MediaIndexPopulator.cs (99%) rename src/{Umbraco.Examine => Umbraco.Examine2}/MemberIndexPopulator.cs (98%) rename src/{Umbraco.Examine => Umbraco.Examine2}/MemberValueSetBuilder.cs (95%) rename src/{Umbraco.Examine => Umbraco.Examine2}/MemberValueSetValidator.cs (96%) create mode 100644 src/Umbraco.Examine2/Umbraco.Examine2.csproj create mode 100644 src/Umbraco.Examine2/UmbracoExamineFieldNames.cs rename src/{Umbraco.Examine => Umbraco.Examine2}/ValueSetValidator.cs (97%) diff --git a/src/Umbraco.Examine/ContentValueSetBuilder.cs b/src/Umbraco.Examine/ContentValueSetBuilder.cs index b2f8ae720b..6de7956e65 100644 --- a/src/Umbraco.Examine/ContentValueSetBuilder.cs +++ b/src/Umbraco.Examine/ContentValueSetBuilder.cs @@ -46,9 +46,9 @@ namespace Umbraco.Examine var values = new Dictionary> { {"icon", c.ContentType.Icon?.Yield() ?? Enumerable.Empty()}, - {UmbracoExamineIndex.PublishedFieldName, new object[] {c.Published ? "y" : "n"}}, //Always add invariant published value + {UmbracoExamineFieldNames.PublishedFieldName, new object[] {c.Published ? "y" : "n"}}, //Always add invariant published value {"id", new object[] {c.Id}}, - {UmbracoExamineIndex.NodeKeyFieldName, new object[] {c.Key}}, + {UmbracoExamineFieldNames.NodeKeyFieldName, new object[] {c.Key}}, {"parentID", new object[] {c.Level > 1 ? c.ParentId : -1}}, {"level", new object[] {c.Level}}, {"creatorID", new object[] {c.CreatorId}}, @@ -65,12 +65,12 @@ namespace Umbraco.Examine {"writerName",(c.GetWriterProfile(_userService)?.Name ?? "??").Yield() }, {"writerID", new object[] {c.WriterId}}, {"templateID", new object[] {c.TemplateId ?? 0}}, - {UmbracoContentIndex.VariesByCultureFieldName, new object[] {"n"}}, + {UmbracoExamineFieldNames.VariesByCultureFieldName, new object[] {"n"}}, }; if (isVariant) { - values[UmbracoContentIndex.VariesByCultureFieldName] = new object[] { "y" }; + values[UmbracoExamineFieldNames.VariesByCultureFieldName] = new object[] { "y" }; foreach (var culture in c.AvailableCultures) { @@ -80,7 +80,7 @@ namespace Umbraco.Examine values[$"nodeName_{lowerCulture}"] = (PublishedValuesOnly ? c.GetPublishName(culture)?.Yield() : c.GetCultureName(culture)?.Yield()) ?? Enumerable.Empty(); - values[$"{UmbracoExamineIndex.PublishedFieldName}_{lowerCulture}"] = (c.IsCulturePublished(culture) ? "y" : "n").Yield(); + values[$"{UmbracoExamineFieldNames.PublishedFieldName}_{lowerCulture}"] = (c.IsCulturePublished(culture) ? "y" : "n").Yield(); values[$"updateDate_{lowerCulture}"] = (PublishedValuesOnly ? c.GetPublishDate(culture) : c.GetUpdateDate(culture))?.Yield() ?? Enumerable.Empty(); diff --git a/src/Umbraco.Examine/ContentValueSetValidator.cs b/src/Umbraco.Examine/ContentValueSetValidator.cs index 9555566c53..2c9fdd4752 100644 --- a/src/Umbraco.Examine/ContentValueSetValidator.cs +++ b/src/Umbraco.Examine/ContentValueSetValidator.cs @@ -92,18 +92,18 @@ namespace Umbraco.Examine //check for published content if (valueSet.Category == IndexTypes.Content && PublishedValuesOnly) { - if (!valueSet.Values.TryGetValue(UmbracoExamineIndex.PublishedFieldName, out var published)) + if (!valueSet.Values.TryGetValue(UmbracoExamineFieldNames.PublishedFieldName, out var published)) return ValueSetValidationResult.Failed; if (!published[0].Equals("y")) return ValueSetValidationResult.Failed; //deal with variants, if there are unpublished variants than we need to remove them from the value set - if (valueSet.Values.TryGetValue(UmbracoContentIndex.VariesByCultureFieldName, out var variesByCulture) + if (valueSet.Values.TryGetValue(UmbracoExamineFieldNames.VariesByCultureFieldName, out var variesByCulture) && variesByCulture.Count > 0 && variesByCulture[0].Equals("y")) { //so this valueset is for a content that varies by culture, now check for non-published cultures and remove those values - foreach(var publishField in valueSet.Values.Where(x => x.Key.StartsWith($"{UmbracoExamineIndex.PublishedFieldName}_")).ToList()) + foreach(var publishField in valueSet.Values.Where(x => x.Key.StartsWith($"{UmbracoExamineFieldNames.PublishedFieldName}_")).ToList()) { if (publishField.Value.Count <= 0 || !publishField.Value[0].Equals("y")) { diff --git a/src/Umbraco.Examine/ExamineExtensions.cs b/src/Umbraco.Examine/ExamineExtensions.cs index d231a86f69..027be708e1 100644 --- a/src/Umbraco.Examine/ExamineExtensions.cs +++ b/src/Umbraco.Examine/ExamineExtensions.cs @@ -8,7 +8,6 @@ using Lucene.Net.Analysis; using Lucene.Net.Index; using Lucene.Net.QueryParsers; using Lucene.Net.Search; -using Lucene.Net.Store; using Umbraco.Core; using Version = Lucene.Net.Util.Version; using Umbraco.Core.Logging; diff --git a/src/Umbraco.Examine/MediaValueSetBuilder.cs b/src/Umbraco.Examine/MediaValueSetBuilder.cs index fd77c180dc..356beb3647 100644 --- a/src/Umbraco.Examine/MediaValueSetBuilder.cs +++ b/src/Umbraco.Examine/MediaValueSetBuilder.cs @@ -77,7 +77,7 @@ namespace Umbraco.Examine { {"icon", m.ContentType.Icon?.Yield() ?? Enumerable.Empty()}, {"id", new object[] {m.Id}}, - {UmbracoExamineIndex.NodeKeyFieldName, new object[] {m.Key}}, + {UmbracoExamineFieldNames.NodeKeyFieldName, new object[] {m.Key}}, {"parentID", new object[] {m.Level > 1 ? m.ParentId : -1}}, {"level", new object[] {m.Level}}, {"creatorID", new object[] {m.CreatorId}}, @@ -89,7 +89,7 @@ namespace Umbraco.Examine {"path", m.Path?.Yield() ?? Enumerable.Empty()}, {"nodeType", m.ContentType.Id.ToString().Yield() }, {"creatorName", (m.GetCreatorProfile(_userService)?.Name ?? "??").Yield()}, - {UmbracoExamineIndex.UmbracoFileFieldName, umbracoFile.Yield()} + {UmbracoExamineFieldNames.UmbracoFileFieldName, umbracoFile.Yield()} }; foreach (var property in m.Properties) diff --git a/src/Umbraco.Examine/Umbraco.Examine.csproj b/src/Umbraco.Examine/Umbraco.Examine.csproj index 047fb7813e..c79c698a81 100644 --- a/src/Umbraco.Examine/Umbraco.Examine.csproj +++ b/src/Umbraco.Examine/Umbraco.Examine.csproj @@ -49,11 +49,8 @@ - - 2.0.0 - - 2.0.0 + 2.0.0-alpha.20200128.15 1.0.0-beta2-19554-01 @@ -69,33 +66,13 @@ - - - - - - - - - - - - - - - - - - - - @@ -108,13 +85,16 @@ Properties\SolutionInfo.cs - {29aa69d9-b597-4395-8d42-43b1263c240a} Umbraco.Abstractions + + {f9b7fe05-0f93-4d0d-9c10-690b33ecbbd8} + Umbraco.Examine2 + {3ae7bf57-966b-45a5-910a-954d7c554441} Umbraco.Infrastructure diff --git a/src/Umbraco.Examine/UmbracoContentIndex.cs b/src/Umbraco.Examine/UmbracoContentIndex.cs index 33fd2d0ee7..1c8cd4b074 100644 --- a/src/Umbraco.Examine/UmbracoContentIndex.cs +++ b/src/Umbraco.Examine/UmbracoContentIndex.cs @@ -20,7 +20,7 @@ namespace Umbraco.Examine /// public class UmbracoContentIndex : UmbracoExamineIndex, IUmbracoContentIndex { - public const string VariesByCultureFieldName = SpecialFieldPrefix + "VariesByCulture"; + protected ILocalizationService LanguageService { get; } #region Constructors @@ -132,7 +132,7 @@ namespace Umbraco.Examine { //find all descendants based on path var descendantPath = $@"\-1\,*{nodeId}\,*"; - var rawQuery = $"{IndexPathFieldName}:{descendantPath}"; + var rawQuery = $"{UmbracoExamineFieldNames.IndexPathFieldName}:{descendantPath}"; var searcher = GetSearcher(); var c = searcher.CreateQuery(); var filtered = c.NativeQuery(rawQuery); diff --git a/src/Umbraco.Examine/UmbracoExamineIndex.cs b/src/Umbraco.Examine/UmbracoExamineIndex.cs index f7dfcf6375..880440f4f9 100644 --- a/src/Umbraco.Examine/UmbracoExamineIndex.cs +++ b/src/Umbraco.Examine/UmbracoExamineIndex.cs @@ -28,19 +28,7 @@ namespace Umbraco.Examine // call context (and the database it can contain)! ideally we should be able to override // SafelyProcessQueueItems but that's not possible in the current version of Examine. - /// - /// Used to store the path of a content object - /// - public const string IndexPathFieldName = SpecialFieldPrefix + "Path"; - public const string NodeKeyFieldName = SpecialFieldPrefix + "Key"; - public const string UmbracoFileFieldName = "umbracoFileSrc"; - public const string IconFieldName = SpecialFieldPrefix + "Icon"; - public const string PublishedFieldName = SpecialFieldPrefix + "Published"; - - /// - /// The prefix added to a field when it is duplicated in order to store the original raw value. - /// - public const string RawFieldPrefix = SpecialFieldPrefix + "Raw_"; + /// /// Create a new @@ -141,7 +129,7 @@ namespace Umbraco.Examine { var d = docArgs.Document; - foreach (var f in docArgs.ValueSet.Values.Where(x => x.Key.StartsWith(RawFieldPrefix)).ToList()) + foreach (var f in docArgs.ValueSet.Values.Where(x => x.Key.StartsWith(UmbracoExamineFieldNames.RawFieldPrefix)).ToList()) { if (f.Value.Count > 0) { @@ -182,13 +170,13 @@ namespace Umbraco.Examine var path = e.ValueSet.GetValue("path"); if (path != null) { - e.ValueSet.Set(IndexPathFieldName, path); + e.ValueSet.Set(UmbracoExamineFieldNames.IndexPathFieldName, path); } //icon - if (e.ValueSet.Values.TryGetValue("icon", out var icon) && e.ValueSet.Values.ContainsKey(IconFieldName) == false) + if (e.ValueSet.Values.TryGetValue("icon", out var icon) && e.ValueSet.Values.ContainsKey(UmbracoExamineFieldNames.IconFieldName) == false) { - e.ValueSet.Values[IconFieldName] = icon; + e.ValueSet.Values[UmbracoExamineFieldNames.IconFieldName] = icon; } } diff --git a/src/Umbraco.Examine/UmbracoFieldDefinitionCollection.cs b/src/Umbraco.Examine/UmbracoFieldDefinitionCollection.cs index 1e7b51aa14..5633b6a2cc 100644 --- a/src/Umbraco.Examine/UmbracoFieldDefinitionCollection.cs +++ b/src/Umbraco.Examine/UmbracoFieldDefinitionCollection.cs @@ -33,7 +33,7 @@ namespace Umbraco.Examine new FieldDefinition("createDate", FieldDefinitionTypes.DateTime), new FieldDefinition("updateDate", FieldDefinitionTypes.DateTime), - new FieldDefinition(UmbracoExamineIndex.NodeKeyFieldName, FieldDefinitionTypes.InvariantCultureIgnoreCase), + new FieldDefinition(UmbracoExamineFieldNames.NodeKeyFieldName, FieldDefinitionTypes.InvariantCultureIgnoreCase), new FieldDefinition("version", FieldDefinitionTypes.Raw), new FieldDefinition("nodeType", FieldDefinitionTypes.InvariantCultureIgnoreCase), new FieldDefinition("template", FieldDefinitionTypes.Raw), @@ -42,10 +42,10 @@ namespace Umbraco.Examine new FieldDefinition("email", FieldDefinitionTypes.EmailAddress), - new FieldDefinition(UmbracoExamineIndex.PublishedFieldName, FieldDefinitionTypes.Raw), - new FieldDefinition(UmbracoExamineIndex.IndexPathFieldName, FieldDefinitionTypes.Raw), - new FieldDefinition(UmbracoExamineIndex.IconFieldName, FieldDefinitionTypes.Raw), - new FieldDefinition(UmbracoContentIndex.VariesByCultureFieldName, FieldDefinitionTypes.Raw), + new FieldDefinition(UmbracoExamineFieldNames.PublishedFieldName, FieldDefinitionTypes.Raw), + new FieldDefinition(UmbracoExamineFieldNames.IndexPathFieldName, FieldDefinitionTypes.Raw), + new FieldDefinition(UmbracoExamineFieldNames.IconFieldName, FieldDefinitionTypes.Raw), + new FieldDefinition(UmbracoExamineFieldNames.VariesByCultureFieldName, FieldDefinitionTypes.Raw), }; diff --git a/src/Umbraco.Examine/BaseValueSetBuilder.cs b/src/Umbraco.Examine2/BaseValueSetBuilder.cs similarity index 100% rename from src/Umbraco.Examine/BaseValueSetBuilder.cs rename to src/Umbraco.Examine2/BaseValueSetBuilder.cs diff --git a/src/Umbraco.Examine/ContentIndexPopulator.cs b/src/Umbraco.Examine2/ContentIndexPopulator.cs similarity index 98% rename from src/Umbraco.Examine/ContentIndexPopulator.cs rename to src/Umbraco.Examine2/ContentIndexPopulator.cs index 99ff4d7f87..8b34c3315a 100644 --- a/src/Umbraco.Examine/ContentIndexPopulator.cs +++ b/src/Umbraco.Examine2/ContentIndexPopulator.cs @@ -6,7 +6,6 @@ using Umbraco.Core; using Umbraco.Core.Models; using Umbraco.Core.Services; using Umbraco.Core.Persistence; -using Umbraco.Core.Persistence.DatabaseModelDefinitions; using Umbraco.Core.Persistence.Querying; namespace Umbraco.Examine diff --git a/src/Umbraco.Examine/IContentValueSetBuilder.cs b/src/Umbraco.Examine2/IContentValueSetBuilder.cs similarity index 100% rename from src/Umbraco.Examine/IContentValueSetBuilder.cs rename to src/Umbraco.Examine2/IContentValueSetBuilder.cs diff --git a/src/Umbraco.Examine/IContentValueSetValidator.cs b/src/Umbraco.Examine2/IContentValueSetValidator.cs similarity index 100% rename from src/Umbraco.Examine/IContentValueSetValidator.cs rename to src/Umbraco.Examine2/IContentValueSetValidator.cs diff --git a/src/Umbraco.Examine/IIndexCreator.cs b/src/Umbraco.Examine2/IIndexCreator.cs similarity index 100% rename from src/Umbraco.Examine/IIndexCreator.cs rename to src/Umbraco.Examine2/IIndexCreator.cs diff --git a/src/Umbraco.Examine/IIndexDiagnostics.cs b/src/Umbraco.Examine2/IIndexDiagnostics.cs similarity index 100% rename from src/Umbraco.Examine/IIndexDiagnostics.cs rename to src/Umbraco.Examine2/IIndexDiagnostics.cs diff --git a/src/Umbraco.Examine/IIndexPopulator.cs b/src/Umbraco.Examine2/IIndexPopulator.cs similarity index 100% rename from src/Umbraco.Examine/IIndexPopulator.cs rename to src/Umbraco.Examine2/IIndexPopulator.cs diff --git a/src/Umbraco.Examine/IPublishedContentValueSetBuilder.cs b/src/Umbraco.Examine2/IPublishedContentValueSetBuilder.cs similarity index 100% rename from src/Umbraco.Examine/IPublishedContentValueSetBuilder.cs rename to src/Umbraco.Examine2/IPublishedContentValueSetBuilder.cs diff --git a/src/Umbraco.Examine/IUmbracoContentIndex.cs b/src/Umbraco.Examine2/IUmbracoContentIndex.cs similarity index 100% rename from src/Umbraco.Examine/IUmbracoContentIndex.cs rename to src/Umbraco.Examine2/IUmbracoContentIndex.cs diff --git a/src/Umbraco.Examine/IUmbracoIndex.cs b/src/Umbraco.Examine2/IUmbracoIndex.cs similarity index 100% rename from src/Umbraco.Examine/IUmbracoIndex.cs rename to src/Umbraco.Examine2/IUmbracoIndex.cs diff --git a/src/Umbraco.Examine/IUmbracoIndexConfig.cs b/src/Umbraco.Examine2/IUmbracoIndexConfig.cs similarity index 100% rename from src/Umbraco.Examine/IUmbracoIndexConfig.cs rename to src/Umbraco.Examine2/IUmbracoIndexConfig.cs diff --git a/src/Umbraco.Examine/IUmbracoMemberIndex.cs b/src/Umbraco.Examine2/IUmbracoMemberIndex.cs similarity index 100% rename from src/Umbraco.Examine/IUmbracoMemberIndex.cs rename to src/Umbraco.Examine2/IUmbracoMemberIndex.cs diff --git a/src/Umbraco.Examine/IValueSetBuilder.cs b/src/Umbraco.Examine2/IValueSetBuilder.cs similarity index 100% rename from src/Umbraco.Examine/IValueSetBuilder.cs rename to src/Umbraco.Examine2/IValueSetBuilder.cs diff --git a/src/Umbraco.Examine/IndexPopulator.cs b/src/Umbraco.Examine2/IndexPopulator.cs similarity index 100% rename from src/Umbraco.Examine/IndexPopulator.cs rename to src/Umbraco.Examine2/IndexPopulator.cs diff --git a/src/Umbraco.Examine/IndexRebuilder.cs b/src/Umbraco.Examine2/IndexRebuilder.cs similarity index 100% rename from src/Umbraco.Examine/IndexRebuilder.cs rename to src/Umbraco.Examine2/IndexRebuilder.cs diff --git a/src/Umbraco.Examine/IndexTypes.cs b/src/Umbraco.Examine2/IndexTypes.cs similarity index 100% rename from src/Umbraco.Examine/IndexTypes.cs rename to src/Umbraco.Examine2/IndexTypes.cs diff --git a/src/Umbraco.Examine/MediaIndexPopulator.cs b/src/Umbraco.Examine2/MediaIndexPopulator.cs similarity index 99% rename from src/Umbraco.Examine/MediaIndexPopulator.cs rename to src/Umbraco.Examine2/MediaIndexPopulator.cs index 1f5b11e54f..03fbe392b6 100644 --- a/src/Umbraco.Examine/MediaIndexPopulator.cs +++ b/src/Umbraco.Examine2/MediaIndexPopulator.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.Linq; using Examine; -using Umbraco.Core; using Umbraco.Core.Models; using Umbraco.Core.Services; diff --git a/src/Umbraco.Examine/MemberIndexPopulator.cs b/src/Umbraco.Examine2/MemberIndexPopulator.cs similarity index 98% rename from src/Umbraco.Examine/MemberIndexPopulator.cs rename to src/Umbraco.Examine2/MemberIndexPopulator.cs index 26a3b0aedd..270d93d80d 100644 --- a/src/Umbraco.Examine/MemberIndexPopulator.cs +++ b/src/Umbraco.Examine2/MemberIndexPopulator.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.Linq; using Examine; -using Lucene.Net.Util; using Umbraco.Core.Models; using Umbraco.Core.Services; diff --git a/src/Umbraco.Examine/MemberValueSetBuilder.cs b/src/Umbraco.Examine2/MemberValueSetBuilder.cs similarity index 95% rename from src/Umbraco.Examine/MemberValueSetBuilder.cs rename to src/Umbraco.Examine2/MemberValueSetBuilder.cs index 06fe78105d..94cd838efe 100644 --- a/src/Umbraco.Examine/MemberValueSetBuilder.cs +++ b/src/Umbraco.Examine2/MemberValueSetBuilder.cs @@ -24,7 +24,7 @@ namespace Umbraco.Examine { {"icon", m.ContentType.Icon?.Yield() ?? Enumerable.Empty()}, {"id", new object[] {m.Id}}, - {UmbracoExamineIndex.NodeKeyFieldName, new object[] {m.Key}}, + {UmbracoExamineFieldNames.NodeKeyFieldName, new object[] {m.Key}}, {"parentID", new object[] {m.Level > 1 ? m.ParentId : -1}}, {"level", new object[] {m.Level}}, {"creatorID", new object[] {m.CreatorId}}, diff --git a/src/Umbraco.Examine/MemberValueSetValidator.cs b/src/Umbraco.Examine2/MemberValueSetValidator.cs similarity index 96% rename from src/Umbraco.Examine/MemberValueSetValidator.cs rename to src/Umbraco.Examine2/MemberValueSetValidator.cs index 0c585854e9..876bc84127 100644 --- a/src/Umbraco.Examine/MemberValueSetValidator.cs +++ b/src/Umbraco.Examine2/MemberValueSetValidator.cs @@ -23,7 +23,7 @@ namespace Umbraco.Examine /// /// By default these are the member fields we index /// - public static readonly string[] DefaultMemberIndexFields = { "id", "nodeName", "updateDate", "loginName", "email", UmbracoExamineIndex.NodeKeyFieldName }; + public static readonly string[] DefaultMemberIndexFields = { "id", "nodeName", "updateDate", "loginName", "email", UmbracoExamineFieldNames.NodeKeyFieldName }; private static readonly IEnumerable ValidCategories = new[] { IndexTypes.Member }; protected override IEnumerable ValidIndexCategories => ValidCategories; diff --git a/src/Umbraco.Examine2/Umbraco.Examine2.csproj b/src/Umbraco.Examine2/Umbraco.Examine2.csproj new file mode 100644 index 0000000000..904d4b7107 --- /dev/null +++ b/src/Umbraco.Examine2/Umbraco.Examine2.csproj @@ -0,0 +1,16 @@ + + + + netstandard2.0 + + + + + + + + + + + + diff --git a/src/Umbraco.Examine2/UmbracoExamineFieldNames.cs b/src/Umbraco.Examine2/UmbracoExamineFieldNames.cs new file mode 100644 index 0000000000..56eb929f17 --- /dev/null +++ b/src/Umbraco.Examine2/UmbracoExamineFieldNames.cs @@ -0,0 +1,23 @@ +using Examine; + +namespace Umbraco.Examine +{ + public static class UmbracoExamineFieldNames + { + /// + /// Used to store the path of a content object + /// + public const string IndexPathFieldName = ExamineFieldNames.SpecialFieldPrefix + "Path"; + public const string NodeKeyFieldName = ExamineFieldNames.SpecialFieldPrefix + "Key"; + public const string UmbracoFileFieldName = "umbracoFileSrc"; + public const string IconFieldName = ExamineFieldNames.SpecialFieldPrefix + "Icon"; + public const string PublishedFieldName = ExamineFieldNames.SpecialFieldPrefix + "Published"; + + /// + /// The prefix added to a field when it is duplicated in order to store the original raw value. + /// + public const string RawFieldPrefix = ExamineFieldNames.SpecialFieldPrefix + "Raw_"; + + public const string VariesByCultureFieldName = ExamineFieldNames.SpecialFieldPrefix + "VariesByCulture"; + } +} diff --git a/src/Umbraco.Examine/ValueSetValidator.cs b/src/Umbraco.Examine2/ValueSetValidator.cs similarity index 97% rename from src/Umbraco.Examine/ValueSetValidator.cs rename to src/Umbraco.Examine2/ValueSetValidator.cs index 4db251c0f1..f6538dfacd 100644 --- a/src/Umbraco.Examine/ValueSetValidator.cs +++ b/src/Umbraco.Examine2/ValueSetValidator.cs @@ -1,8 +1,6 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Examine; -using Examine.LuceneEngine.Providers; using Umbraco.Core; namespace Umbraco.Examine diff --git a/src/Umbraco.Tests/LegacyXmlPublishedCache/DictionaryPublishedContent.cs b/src/Umbraco.Tests/LegacyXmlPublishedCache/DictionaryPublishedContent.cs index 31fbb8d6b9..f873f3a683 100644 --- a/src/Umbraco.Tests/LegacyXmlPublishedCache/DictionaryPublishedContent.cs +++ b/src/Umbraco.Tests/LegacyXmlPublishedCache/DictionaryPublishedContent.cs @@ -1,9 +1,9 @@ -using System; +using Examine; +using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Xml.XPath; -using Examine.LuceneEngine.Providers; using Umbraco.Core; using Umbraco.Core.Cache; using Umbraco.Core.Logging; @@ -59,7 +59,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache ValidateAndSetProperty(valueDictionary, val => _sortOrder = Int32.Parse(val), "sortOrder"); ValidateAndSetProperty(valueDictionary, val => _name = val, "nodeName"); ValidateAndSetProperty(valueDictionary, val => _urlName = val, "urlName"); - ValidateAndSetProperty(valueDictionary, val => _documentTypeAlias = val, "nodeTypeAlias", LuceneIndex.ItemTypeFieldName); + ValidateAndSetProperty(valueDictionary, val => _documentTypeAlias = val, "nodeTypeAlias", ExamineFieldNames.ItemTypeFieldName); ValidateAndSetProperty(valueDictionary, val => _documentTypeId = Int32.Parse(val), "nodeType"); //ValidateAndSetProperty(valueDictionary, val => _writerName = val, "writerName"); ValidateAndSetProperty(valueDictionary, val => _creatorName = val, "creatorName", "writerName"); //this is a bit of a hack fix for: U4-1132 diff --git a/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedMediaCache.cs b/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedMediaCache.cs index f913d1c9b8..03c6ddba47 100644 --- a/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedMediaCache.cs +++ b/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedMediaCache.cs @@ -120,7 +120,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache // +(+parentID:-1) +__IndexType:media var criteria = searchProvider.CreateQuery("media"); - var filter = criteria.ParentId(-1).Not().Field(UmbracoExamineIndex.IndexPathFieldName, "-1,-21,".MultipleCharacterWildcard()); + var filter = criteria.ParentId(-1).Not().Field(UmbracoExamineFieldNames.IndexPathFieldName, "-1,-21,".MultipleCharacterWildcard()); var result = filter.Execute(); if (result != null) @@ -289,7 +289,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache // note that since the use of the wildcard, it automatically escapes it in Lucene. var criteria = searchProvider.CreateQuery("media"); - var filter = criteria.Id(id.ToInvariantString()).Not().Field(UmbracoExamineIndex.IndexPathFieldName, "-1,-21,".MultipleCharacterWildcard()); + var filter = criteria.Id(id.ToInvariantString()).Not().Field(UmbracoExamineFieldNames.IndexPathFieldName, "-1,-21,".MultipleCharacterWildcard()); var result = filter.Execute().FirstOrDefault(); if (result != null) return ConvertFromSearchResult(result); @@ -471,7 +471,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache { //We are going to check for a special field however, that is because in some cases we store a 'Raw' //value in the index such as for xml/html. - var rawValue = dd.Properties.FirstOrDefault(x => x.Alias.InvariantEquals(UmbracoExamineIndex.RawFieldPrefix + alias)); + var rawValue = dd.Properties.FirstOrDefault(x => x.Alias.InvariantEquals(UmbracoExamineFieldNames.RawFieldPrefix + alias)); return rawValue ?? dd.Properties.FirstOrDefault(x => x.Alias.InvariantEquals(alias)); } @@ -504,7 +504,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache //first check in Examine as this is WAY faster var criteria = searchProvider.CreateQuery("media"); - var filter = criteria.ParentId(parentId).Not().Field(UmbracoExamineIndex.IndexPathFieldName, "-1,-21,".MultipleCharacterWildcard()) + var filter = criteria.ParentId(parentId).Not().Field(UmbracoExamineFieldNames.IndexPathFieldName, "-1,-21,".MultipleCharacterWildcard()) .OrderBy(new SortableField("sortOrder", SortType.Int)); //the above filter will create a query like this, NOTE: That since the use of the wildcard, it automatically escapes it in Lucene. //+(+parentId:3113 -__Path:-1,-21,*) +__IndexType:media diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index 2892e39b49..2ae54d7aa3 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -79,7 +79,7 @@ - 2.0.0 + 2.0.0-alpha.20200128.15 1.8.14 @@ -564,6 +564,10 @@ {fbe7c065-dac0-4025-a78b-63b24d3ab00b} Umbraco.Configuration + + {f9b7fe05-0f93-4d0d-9c10-690b33ecbbd8} + Umbraco.Examine2 + {3ae7bf57-966b-45a5-910a-954d7c554441} Umbraco.Infrastructure diff --git a/src/Umbraco.Tests/UmbracoExamine/IndexTest.cs b/src/Umbraco.Tests/UmbracoExamine/IndexTest.cs index e41169c6ec..e6fe5170e4 100644 --- a/src/Umbraco.Tests/UmbracoExamine/IndexTest.cs +++ b/src/Umbraco.Tests/UmbracoExamine/IndexTest.cs @@ -114,8 +114,8 @@ namespace Umbraco.Tests.UmbracoExamine Assert.AreEqual("value2", result.AllValues["grid.row1"][1]); Assert.IsTrue(result.Values.ContainsKey("grid")); Assert.AreEqual("value1 value2 ", result["grid"]); - Assert.IsTrue(result.Values.ContainsKey($"{UmbracoExamineIndex.RawFieldPrefix}grid")); - Assert.AreEqual(json, result[$"{UmbracoExamineIndex.RawFieldPrefix}grid"]); + Assert.IsTrue(result.Values.ContainsKey($"{UmbracoExamineFieldNames.RawFieldPrefix}grid")); + Assert.AreEqual(json, result[$"{UmbracoExamineFieldNames.RawFieldPrefix}grid"]); } } @@ -165,12 +165,12 @@ namespace Umbraco.Tests.UmbracoExamine var protectedQuery = new BooleanQuery(); protectedQuery.Add( new BooleanClause( - new TermQuery(new Term(LuceneIndex.CategoryFieldName, IndexTypes.Content)), + new TermQuery(new Term(ExamineFieldNames.CategoryFieldName, IndexTypes.Content)), Occur.MUST)); protectedQuery.Add( new BooleanClause( - new TermQuery(new Term(LuceneIndex.ItemIdFieldName, ExamineDemoDataContentService.ProtectedNode.ToString())), + new TermQuery(new Term(ExamineFieldNames.ItemIdFieldName, ExamineDemoDataContentService.ProtectedNode.ToString())), Occur.MUST)); var collector = TopScoreDocCollector.Create(100, true); @@ -287,7 +287,7 @@ namespace Umbraco.Tests.UmbracoExamine //create the whole thing rebuilder.Populate(indexer); - var result = searcher.CreateQuery().Field(LuceneIndex.CategoryFieldName, IndexTypes.Content).Execute(); + var result = searcher.CreateQuery().Field(ExamineFieldNames.CategoryFieldName, IndexTypes.Content).Execute(); Assert.AreEqual(21, result.TotalItemCount); //delete all content @@ -298,13 +298,13 @@ namespace Umbraco.Tests.UmbracoExamine //ensure it's all gone - result = searcher.CreateQuery().Field(LuceneIndex.CategoryFieldName, IndexTypes.Content).Execute(); + result = searcher.CreateQuery().Field(ExamineFieldNames.CategoryFieldName, IndexTypes.Content).Execute(); Assert.AreEqual(0, result.TotalItemCount); //call our indexing methods rebuilder.Populate(indexer); - result = searcher.CreateQuery().Field(LuceneIndex.CategoryFieldName, IndexTypes.Content).Execute(); + result = searcher.CreateQuery().Field(ExamineFieldNames.CategoryFieldName, IndexTypes.Content).Execute(); Assert.AreEqual(21, result.TotalItemCount); } } diff --git a/src/Umbraco.Tests/UmbracoExamine/UmbracoContentValueSetValidatorTests.cs b/src/Umbraco.Tests/UmbracoExamine/UmbracoContentValueSetValidatorTests.cs index 8bdb0c71c7..643c56250d 100644 --- a/src/Umbraco.Tests/UmbracoExamine/UmbracoContentValueSetValidatorTests.cs +++ b/src/Umbraco.Tests/UmbracoExamine/UmbracoContentValueSetValidatorTests.cs @@ -179,7 +179,7 @@ namespace Umbraco.Tests.UmbracoExamine { ["hello"] = "world", ["path"] = "-1,555", - [UmbracoExamineIndex.PublishedFieldName] = "y" + [UmbracoExamineFieldNames.PublishedFieldName] = "y" })); Assert.AreEqual(ValueSetValidationResult.Valid, result); } @@ -213,7 +213,7 @@ namespace Umbraco.Tests.UmbracoExamine { ["hello"] = "world", ["path"] = "-1,555", - [UmbracoExamineIndex.PublishedFieldName] = "n" + [UmbracoExamineFieldNames.PublishedFieldName] = "n" })); Assert.AreEqual(ValueSetValidationResult.Failed, result); @@ -222,7 +222,7 @@ namespace Umbraco.Tests.UmbracoExamine { ["hello"] = "world", ["path"] = "-1,555", - [UmbracoExamineIndex.PublishedFieldName] = "y" + [UmbracoExamineFieldNames.PublishedFieldName] = "y" })); Assert.AreEqual(ValueSetValidationResult.Valid, result); } @@ -237,8 +237,8 @@ namespace Umbraco.Tests.UmbracoExamine { ["hello"] = "world", ["path"] = "-1,555", - [UmbracoContentIndex.VariesByCultureFieldName] = "y", - [UmbracoExamineIndex.PublishedFieldName] = "n" + [UmbracoExamineFieldNames.VariesByCultureFieldName] = "y", + [UmbracoExamineFieldNames.PublishedFieldName] = "n" })); Assert.AreEqual(ValueSetValidationResult.Failed, result); @@ -247,8 +247,8 @@ namespace Umbraco.Tests.UmbracoExamine { ["hello"] = "world", ["path"] = "-1,555", - [UmbracoContentIndex.VariesByCultureFieldName] = "y", - [UmbracoExamineIndex.PublishedFieldName] = "y" + [UmbracoExamineFieldNames.VariesByCultureFieldName] = "y", + [UmbracoExamineFieldNames.PublishedFieldName] = "y" })); Assert.AreEqual(ValueSetValidationResult.Valid, result); @@ -257,17 +257,17 @@ namespace Umbraco.Tests.UmbracoExamine { ["hello"] = "world", ["path"] = "-1,555", - [UmbracoContentIndex.VariesByCultureFieldName] = "y", - [$"{UmbracoExamineIndex.PublishedFieldName}_en-us"] = "y", + [UmbracoExamineFieldNames.VariesByCultureFieldName] = "y", + [$"{UmbracoExamineFieldNames.PublishedFieldName}_en-us"] = "y", ["hello_en-us"] = "world", ["title_en-us"] = "my title", - [$"{UmbracoExamineIndex.PublishedFieldName}_es-es"] = "n", + [$"{UmbracoExamineFieldNames.PublishedFieldName}_es-es"] = "n", ["hello_es-ES"] = "world", ["title_es-ES"] = "my title", - [UmbracoExamineIndex.PublishedFieldName] = "y" + [UmbracoExamineFieldNames.PublishedFieldName] = "y" }); Assert.AreEqual(10, valueSet.Values.Count()); - Assert.IsTrue(valueSet.Values.ContainsKey($"{UmbracoExamineIndex.PublishedFieldName}_es-es")); + Assert.IsTrue(valueSet.Values.ContainsKey($"{UmbracoExamineFieldNames.PublishedFieldName}_es-es")); Assert.IsTrue(valueSet.Values.ContainsKey("hello_es-ES")); Assert.IsTrue(valueSet.Values.ContainsKey("title_es-ES")); @@ -275,7 +275,7 @@ namespace Umbraco.Tests.UmbracoExamine Assert.AreEqual(ValueSetValidationResult.Filtered, result); Assert.AreEqual(7, valueSet.Values.Count()); //filtered to 7 values (removes es-es values) - Assert.IsFalse(valueSet.Values.ContainsKey($"{UmbracoExamineIndex.PublishedFieldName}_es-es")); + Assert.IsFalse(valueSet.Values.ContainsKey($"{UmbracoExamineFieldNames.PublishedFieldName}_es-es")); Assert.IsFalse(valueSet.Values.ContainsKey("hello_es-ES")); Assert.IsFalse(valueSet.Values.ContainsKey("title_es-ES")); } diff --git a/src/Umbraco.Tests/Web/PublishedContentQueryTests.cs b/src/Umbraco.Tests/Web/PublishedContentQueryTests.cs index a3505aeb0e..74ab279fb8 100644 --- a/src/Umbraco.Tests/Web/PublishedContentQueryTests.cs +++ b/src/Umbraco.Tests/Web/PublishedContentQueryTests.cs @@ -42,17 +42,17 @@ namespace Umbraco.Tests.Web indexer.IndexItem(new ValueSet("1", "content", new Dictionary { [fieldNames[0]] = "Hello world, there are products here", - [UmbracoContentIndex.VariesByCultureFieldName] = "n" + [UmbracoExamineFieldNames.VariesByCultureFieldName] = "n" })); indexer.IndexItem(new ValueSet("2", "content", new Dictionary { [fieldNames[1]] = "Hello world, there are products here", - [UmbracoContentIndex.VariesByCultureFieldName] = "y" + [UmbracoExamineFieldNames.VariesByCultureFieldName] = "y" })); indexer.IndexItem(new ValueSet("3", "content", new Dictionary { [fieldNames[2]] = "Hello world, there are products here", - [UmbracoContentIndex.VariesByCultureFieldName] = "y" + [UmbracoExamineFieldNames.VariesByCultureFieldName] = "y" })); } diff --git a/src/Umbraco.Web/ExamineExtensions.cs b/src/Umbraco.Web/ExamineExtensions.cs index 421993f8fd..dd1277d3e2 100644 --- a/src/Umbraco.Web/ExamineExtensions.cs +++ b/src/Umbraco.Web/ExamineExtensions.cs @@ -65,7 +65,7 @@ namespace Umbraco.Web foreach (var result in results) { if (int.TryParse(result.Id, out var contentId) && - result.Values.TryGetValue(LuceneIndex.CategoryFieldName, out var indexType)) + result.Values.TryGetValue(ExamineFieldNames.CategoryFieldName, out var indexType)) { IPublishedContent content; switch (indexType) diff --git a/src/Umbraco.Web/Models/Mapping/EntityMapDefinition.cs b/src/Umbraco.Web/Models/Mapping/EntityMapDefinition.cs index 34b8f664f3..0697504e2a 100644 --- a/src/Umbraco.Web/Models/Mapping/EntityMapDefinition.cs +++ b/src/Umbraco.Web/Models/Mapping/EntityMapDefinition.cs @@ -171,13 +171,13 @@ namespace Umbraco.Web.Models.Mapping // TODO: Properly map this (not aftermap) //get the icon if there is one - target.Icon = source.Values.ContainsKey(UmbracoExamineIndex.IconFieldName) - ? source.Values[UmbracoExamineIndex.IconFieldName] + target.Icon = source.Values.ContainsKey(UmbracoExamineFieldNames.IconFieldName) + ? source.Values[UmbracoExamineFieldNames.IconFieldName] : Constants.Icons.DefaultIcon; target.Name = source.Values.ContainsKey("nodeName") ? source.Values["nodeName"] : "[no name]"; - if (source.Values.TryGetValue(UmbracoExamineIndex.UmbracoFileFieldName, out var umbracoFile)) + if (source.Values.TryGetValue(UmbracoExamineFieldNames.UmbracoFileFieldName, out var umbracoFile)) { if (umbracoFile != null) { @@ -185,16 +185,16 @@ namespace Umbraco.Web.Models.Mapping } } - if (source.Values.ContainsKey(UmbracoExamineIndex.NodeKeyFieldName)) + if (source.Values.ContainsKey(UmbracoExamineFieldNames.NodeKeyFieldName)) { - if (Guid.TryParse(source.Values[UmbracoExamineIndex.NodeKeyFieldName], out var key)) + if (Guid.TryParse(source.Values[UmbracoExamineFieldNames.NodeKeyFieldName], out var key)) { target.Key = key; //need to set the UDI - if (source.Values.ContainsKey(LuceneIndex.CategoryFieldName)) + if (source.Values.ContainsKey(ExamineFieldNames.CategoryFieldName)) { - switch (source.Values[LuceneIndex.CategoryFieldName]) + switch (source.Values[ExamineFieldNames.CategoryFieldName]) { case IndexTypes.Member: target.Udi = new GuidUdi(Constants.UdiEntityType.Member, target.Key); @@ -222,11 +222,11 @@ namespace Umbraco.Web.Models.Mapping } } - target.Path = source.Values.ContainsKey(UmbracoExamineIndex.IndexPathFieldName) ? source.Values[UmbracoExamineIndex.IndexPathFieldName] : ""; + target.Path = source.Values.ContainsKey(UmbracoExamineFieldNames.IndexPathFieldName) ? source.Values[UmbracoExamineFieldNames.IndexPathFieldName] : ""; - if (source.Values.ContainsKey(LuceneIndex.ItemTypeFieldName)) + if (source.Values.ContainsKey(ExamineFieldNames.ItemTypeFieldName)) { - target.AdditionalData.Add("contentType", source.Values[LuceneIndex.ItemTypeFieldName]); + target.AdditionalData.Add("contentType", source.Values[ExamineFieldNames.ItemTypeFieldName]); } } diff --git a/src/Umbraco.Web/PropertyEditors/GridPropertyIndexValueFactory.cs b/src/Umbraco.Web/PropertyEditors/GridPropertyIndexValueFactory.cs index af72f0b819..00afcf19cc 100644 --- a/src/Umbraco.Web/PropertyEditors/GridPropertyIndexValueFactory.cs +++ b/src/Umbraco.Web/PropertyEditors/GridPropertyIndexValueFactory.cs @@ -63,7 +63,7 @@ namespace Umbraco.Web.PropertyEditors } //First save the raw value to a raw field - result.Add(new KeyValuePair>($"{UmbracoExamineIndex.RawFieldPrefix}{property.Alias}", new[] { rawVal })); + result.Add(new KeyValuePair>($"{UmbracoExamineFieldNames.RawFieldPrefix}{property.Alias}", new[] { rawVal })); if (sb.Length > 0) { diff --git a/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs index 0a6ef88781..7cf9e3a6d9 100644 --- a/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs @@ -185,7 +185,7 @@ namespace Umbraco.Web.PropertyEditors //index the stripped HTML values yield return new KeyValuePair>(property.Alias, new object[] { strVal.StripHtml() }); //store the raw value - yield return new KeyValuePair>($"{UmbracoExamineIndex.RawFieldPrefix}{property.Alias}", new object[] { strVal }); + yield return new KeyValuePair>($"{UmbracoExamineFieldNames.RawFieldPrefix}{property.Alias}", new object[] { strVal }); } } } diff --git a/src/Umbraco.Web/PublishedContentExtensions.cs b/src/Umbraco.Web/PublishedContentExtensions.cs index 223b7dbaf1..5466c4a86e 100644 --- a/src/Umbraco.Web/PublishedContentExtensions.cs +++ b/src/Umbraco.Web/PublishedContentExtensions.cs @@ -208,7 +208,7 @@ namespace Umbraco.Web //var luceneQuery = "+__Path:(" + content.Path.Replace("-", "\\-") + "*) +" + t; var query = searcher.CreateQuery() - .Field(UmbracoExamineIndex.IndexPathFieldName, (content.Path + ",").MultipleCharacterWildcard()) + .Field(UmbracoExamineFieldNames.IndexPathFieldName, (content.Path + ",").MultipleCharacterWildcard()) .And() .ManagedQuery(term); diff --git a/src/Umbraco.Web/PublishedContentQuery.cs b/src/Umbraco.Web/PublishedContentQuery.cs index cf145f8d44..f35cea085d 100644 --- a/src/Umbraco.Web/PublishedContentQuery.cs +++ b/src/Umbraco.Web/PublishedContentQuery.cs @@ -216,7 +216,7 @@ namespace Umbraco.Web else if (string.IsNullOrWhiteSpace(culture)) { // Only search invariant - queryExecutor = query.Field(UmbracoContentIndex.VariesByCultureFieldName, "n") // Must not vary by culture + queryExecutor = query.Field(UmbracoExamineFieldNames.VariesByCultureFieldName, "n") // Must not vary by culture .And().ManagedQuery(term); } else diff --git a/src/Umbraco.Web/Search/UmbracoTreeSearcher.cs b/src/Umbraco.Web/Search/UmbracoTreeSearcher.cs index f9ef0f0a31..306d4c0593 100644 --- a/src/Umbraco.Web/Search/UmbracoTreeSearcher.cs +++ b/src/Umbraco.Web/Search/UmbracoTreeSearcher.cs @@ -242,7 +242,7 @@ namespace Umbraco.Web.Search var queryWordsReplaced = new string[querywords.Length]; // when searching file names containing hyphens we need to replace the hyphens with spaces - if (f.Equals(UmbracoExamineIndex.UmbracoFileFieldName)) + if (f.Equals(UmbracoExamineFieldNames.UmbracoFileFieldName)) { for (var index = 0; index < querywords.Length; index++) { @@ -418,9 +418,9 @@ namespace Umbraco.Web.Search { m.AdditionalData["Email"] = result.Values["email"]; } - if (result.Values.ContainsKey(UmbracoExamineIndex.NodeKeyFieldName) && result.Values[UmbracoExamineIndex.NodeKeyFieldName] != null) + if (result.Values.ContainsKey(UmbracoExamineFieldNames.NodeKeyFieldName) && result.Values[UmbracoExamineFieldNames.NodeKeyFieldName] != null) { - if (Guid.TryParse(result.Values[UmbracoExamineIndex.NodeKeyFieldName], out var key)) + if (Guid.TryParse(result.Values[UmbracoExamineFieldNames.NodeKeyFieldName], out var key)) { m.Key = key; } @@ -455,7 +455,7 @@ namespace Umbraco.Web.Search if (intId.Success) { //if it varies by culture, return the default language URL - if (result.Values.TryGetValue(UmbracoContentIndex.VariesByCultureFieldName, out var varies) && varies == "y") + if (result.Values.TryGetValue(UmbracoExamineFieldNames.VariesByCultureFieldName, out var varies) && varies == "y") { entity.AdditionalData["Url"] = _umbracoContext.Url(intId.Result, defaultLang); } diff --git a/src/Umbraco.Web/Search/UmbracoTreeSearcherFields.cs b/src/Umbraco.Web/Search/UmbracoTreeSearcherFields.cs index f90d7bc6b6..a1c9936542 100644 --- a/src/Umbraco.Web/Search/UmbracoTreeSearcherFields.cs +++ b/src/Umbraco.Web/Search/UmbracoTreeSearcherFields.cs @@ -18,7 +18,7 @@ namespace Umbraco.Web.Search { return _backOfficeMembersFields; } - private IReadOnlyList _backOfficeMediaFields = new List {UmbracoExamineIndex.UmbracoFileFieldName }; + private IReadOnlyList _backOfficeMediaFields = new List { UmbracoExamineFieldNames.UmbracoFileFieldName }; public IEnumerable GetBackOfficeMediaFields() { return _backOfficeMediaFields; diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 72a46481ea..8c73da3db8 100755 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -63,10 +63,10 @@ - 2.0.0 + 2.0.0-alpha.20200128.15 - 2.0.0 + 2.0.0-alpha.20200128.15 @@ -112,6 +112,10 @@ {fbe7c065-dac0-4025-a78b-63b24d3ab00b} Umbraco.Configuration + + {f9b7fe05-0f93-4d0d-9c10-690b33ecbbd8} + Umbraco.Examine2 + {07fbc26b-2927-4a22-8d96-d644c667fecc} Umbraco.Examine diff --git a/src/umbraco.sln b/src/umbraco.sln index 0e060fb4d3..72c713c64f 100644 --- a/src/umbraco.sln +++ b/src/umbraco.sln @@ -1,4 +1,5 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 + +Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29209.152 MinimumVisualStudioVersion = 10.0.40219.1 @@ -100,18 +101,20 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "IssueTemplates", "IssueTemp ..\.github\ISSUE_TEMPLATE\5_Security_issue.md = ..\.github\ISSUE_TEMPLATE\5_Security_issue.md EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Abstractions", "Umbraco.Abstractions\Umbraco.Abstractions.csproj", "{29AA69D9-B597-4395-8D42-43B1263C240A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Umbraco.Abstractions", "Umbraco.Abstractions\Umbraco.Abstractions.csproj", "{29AA69D9-B597-4395-8D42-43B1263C240A}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.ModelsBuilder.Embedded", "Umbraco.ModelsBuilder.Embedded\Umbraco.ModelsBuilder.Embedded.csproj", "{52AC0BA8-A60E-4E36-897B-E8B97A54ED1C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Infrastructure", "Umbraco.Infrastructure\Umbraco.Infrastructure.csproj", "{3AE7BF57-966B-45A5-910A-954D7C554441}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Umbraco.Infrastructure", "Umbraco.Infrastructure\Umbraco.Infrastructure.csproj", "{3AE7BF57-966B-45A5-910A-954D7C554441}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Configuration", "Umbraco.Configuration\Umbraco.Configuration.csproj", "{FBE7C065-DAC0-4025-A78B-63B24D3AB00B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Umbraco.Configuration", "Umbraco.Configuration\Umbraco.Configuration.csproj", "{FBE7C065-DAC0-4025-A78B-63B24D3AB00B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Infrastrucure.Persistance.SqlCe", "Umbraco.Infrastrucure.Persistance.SqlCe\Umbraco.Infrastrucure.Persistance.SqlCe.csproj", "{33085570-9BF2-4065-A9B0-A29D920D13BA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Umbraco.Infrastrucure.Persistance.SqlCe", "Umbraco.Infrastrucure.Persistance.SqlCe\Umbraco.Infrastrucure.Persistance.SqlCe.csproj", "{33085570-9BF2-4065-A9B0-A29D920D13BA}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.TestData", "Umbraco.TestData\Umbraco.TestData.csproj", "{FB5676ED-7A69-492C-B802-E7B24144C0FC}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Examine2", "Umbraco.Examine2\Umbraco.Examine2.csproj", "{F9B7FE05-0F93-4D0D-9C10-690B33ECBBD8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -164,6 +167,10 @@ Global {FB5676ED-7A69-492C-B802-E7B24144C0FC}.Debug|Any CPU.Build.0 = Debug|Any CPU {FB5676ED-7A69-492C-B802-E7B24144C0FC}.Release|Any CPU.ActiveCfg = Release|Any CPU {FB5676ED-7A69-492C-B802-E7B24144C0FC}.Release|Any CPU.Build.0 = Release|Any CPU + {F9B7FE05-0F93-4D0D-9C10-690B33ECBBD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F9B7FE05-0F93-4D0D-9C10-690B33ECBBD8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F9B7FE05-0F93-4D0D-9C10-690B33ECBBD8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F9B7FE05-0F93-4D0D-9C10-690B33ECBBD8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE