From 162f8480d17fa8a3422700f08767fc14fd895522 Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 13 Dec 2018 23:17:58 +1100 Subject: [PATCH] more tweaks to get config based indexes working, updates to IIndexPopulator to have strongly typed association --- build/NuSpecs/UmbracoCms.Web.nuspec | 2 +- src/Umbraco.Examine/ContentIndexPopulator.cs | 5 +---- src/Umbraco.Examine/IIndexPopulator.cs | 10 ++++++---- src/Umbraco.Examine/IndexPopulator.cs | 19 ++++++++++++++++--- src/Umbraco.Examine/IndexRebuilder.cs | 4 ++-- src/Umbraco.Examine/MediaIndexPopulator.cs | 5 +---- src/Umbraco.Examine/MemberIndexPopulator.cs | 4 +--- src/Umbraco.Examine/Umbraco.Examine.csproj | 2 +- src/Umbraco.Tests/Umbraco.Tests.csproj | 2 +- src/Umbraco.Tests/UmbracoExamine/IndexTest.cs | 3 --- .../UmbracoExamine/SearchTests.cs | 1 - src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 2 +- .../Editors/ExamineManagementController.cs | 12 ++++++------ src/Umbraco.Web/Umbraco.Web.csproj | 2 +- 14 files changed, 38 insertions(+), 35 deletions(-) diff --git a/build/NuSpecs/UmbracoCms.Web.nuspec b/build/NuSpecs/UmbracoCms.Web.nuspec index d36c4a240a..11d9004a34 100644 --- a/build/NuSpecs/UmbracoCms.Web.nuspec +++ b/build/NuSpecs/UmbracoCms.Web.nuspec @@ -14,7 +14,7 @@ Contains the core assemblies needed to run Umbraco Cms en-US umbraco - + - + diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index 38c049f7aa..810ebe5ab4 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -77,7 +77,7 @@ - + 1.8.9 diff --git a/src/Umbraco.Tests/UmbracoExamine/IndexTest.cs b/src/Umbraco.Tests/UmbracoExamine/IndexTest.cs index 35e3524459..2f0adfcb25 100644 --- a/src/Umbraco.Tests/UmbracoExamine/IndexTest.cs +++ b/src/Umbraco.Tests/UmbracoExamine/IndexTest.cs @@ -130,8 +130,6 @@ namespace Umbraco.Tests.UmbracoExamine validator: new ContentValueSetValidator(false))) using (indexer.ProcessNonAsync()) { - contentRebuilder.RegisterIndex(indexer.Name); - mediaRebuilder.RegisterIndex(indexer.Name); var searcher = indexer.GetSearcher(); @@ -283,7 +281,6 @@ namespace Umbraco.Tests.UmbracoExamine validator: new ContentValueSetValidator(false))) using (indexer.ProcessNonAsync()) { - rebuilder.RegisterIndex(indexer.Name); var searcher = indexer.GetSearcher(); diff --git a/src/Umbraco.Tests/UmbracoExamine/SearchTests.cs b/src/Umbraco.Tests/UmbracoExamine/SearchTests.cs index a01d49cc22..8156f640d6 100644 --- a/src/Umbraco.Tests/UmbracoExamine/SearchTests.cs +++ b/src/Umbraco.Tests/UmbracoExamine/SearchTests.cs @@ -62,7 +62,6 @@ namespace Umbraco.Tests.UmbracoExamine using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir)) using (indexer.ProcessNonAsync()) { - rebuilder.RegisterIndex(indexer.Name); indexer.CreateIndex(); rebuilder.Populate(indexer); diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 88155846d7..4a34e23afb 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -88,7 +88,7 @@ - + diff --git a/src/Umbraco.Web/Editors/ExamineManagementController.cs b/src/Umbraco.Web/Editors/ExamineManagementController.cs index 6667510b49..bce2c4a438 100644 --- a/src/Umbraco.Web/Editors/ExamineManagementController.cs +++ b/src/Umbraco.Web/Editors/ExamineManagementController.cs @@ -109,7 +109,7 @@ namespace Umbraco.Web.Editors if (!validate.IsSuccessStatusCode) throw new HttpResponseException(validate); - validate = ValidatePopulator(indexName); + validate = ValidatePopulator(index); if (!validate.IsSuccessStatusCode) throw new HttpResponseException(validate); @@ -134,7 +134,7 @@ namespace Umbraco.Web.Editors if (!validate.IsSuccessStatusCode) return validate; - validate = ValidatePopulator(indexName); + validate = ValidatePopulator(index); if (!validate.IsSuccessStatusCode) return validate; @@ -201,7 +201,7 @@ namespace Umbraco.Web.Editors Name = indexName, HealthStatus = isHealth.Success ? (isHealth.Result ?? "Healthy") : (isHealth.Result ?? "Unhealthy"), ProviderProperties = properties, - CanRebuild = _indexRebuilder.CanRebuild(indexName) + CanRebuild = _indexRebuilder.CanRebuild(index) }; @@ -228,13 +228,13 @@ namespace Umbraco.Web.Editors return response1; } - private HttpResponseMessage ValidatePopulator(string indexName) + private HttpResponseMessage ValidatePopulator(IIndex index) { - if (_indexRebuilder.CanRebuild(indexName)) + if (_indexRebuilder.CanRebuild(index)) return Request.CreateResponse(HttpStatusCode.OK); var response = Request.CreateResponse(HttpStatusCode.BadRequest); - response.Content = new StringContent($"The index {indexName} cannot be rebuilt because it does not have an associated {typeof(IIndexPopulator)}"); + response.Content = new StringContent($"The index {index.Name} cannot be rebuilt because it does not have an associated {typeof(IIndexPopulator)}"); response.ReasonPhrase = "Index cannot be rebuilt"; return response; } diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 9a96acbd8c..8006277c73 100755 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -62,7 +62,7 @@ - + 2.6.2.25