From c866cf52f357775cfb38e7903720e047b6035f3f Mon Sep 17 00:00:00 2001 From: Sean Wright Date: Thu, 26 May 2022 17:33:37 -0400 Subject: [PATCH 1/7] build(vscode): add workspace settings to support VS Code --- .vscode/settings.json | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..02ac4a1 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,20 @@ +{ + "files.exclude": { + "**/.git": true, + "**/.svn": true, + "**/.hg": true, + "**/CVS": true, + "**/.DS_Store": true + }, + + "search.exclude": { + "**/node_modules": true, + "**/bower_components": true, + "**/*.code-search": true, + "**/bin": true, + "**/obj": true + }, + + "omnisharp.defaultLaunchSolution": "./XperienceAlgolia.sln", + "omnisharp.enableImportCompletion": true +} From 13c30e3b974bde551f842e21e667570484e65933 Mon Sep 17 00:00:00 2001 From: Sean Wright Date: Thu, 26 May 2022 17:35:06 -0400 Subject: [PATCH 2/7] chore(sln): clean up XML doc comments --- src/AlgoliaQueueWorker.cs | 2 +- src/AlgoliaStartupExtensions.cs | 1 + src/Models/Facets/AlgoliaFacetFilterViewModel.cs | 4 +--- src/Services/Implementations/DefaultAlgoliaIndexingService.cs | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/AlgoliaQueueWorker.cs b/src/AlgoliaQueueWorker.cs index 0b9c820..f849b43 100644 --- a/src/AlgoliaQueueWorker.cs +++ b/src/AlgoliaQueueWorker.cs @@ -36,7 +36,7 @@ public AlgoliaQueueWorker() /// /// Adds an to the worker queue to be processed. /// - /// + /// public static void EnqueueAlgoliaQueueItem(AlgoliaQueueItem queueItem) { if (queueItem == null || queueItem.Node == null || String.IsNullOrEmpty(queueItem.IndexName)) diff --git a/src/AlgoliaStartupExtensions.cs b/src/AlgoliaStartupExtensions.cs index e9662b2..7e7e3e6 100644 --- a/src/AlgoliaStartupExtensions.cs +++ b/src/AlgoliaStartupExtensions.cs @@ -18,6 +18,7 @@ public static class AlgoliaStartupExtensions /// Registers instances of and /// with Dependency Injection. /// + /// /// The application configuration. public static IServiceCollection AddAlgolia(this IServiceCollection services, IConfiguration configuration) { diff --git a/src/Models/Facets/AlgoliaFacetFilterViewModel.cs b/src/Models/Facets/AlgoliaFacetFilterViewModel.cs index 2a99e15..320c384 100644 --- a/src/Models/Facets/AlgoliaFacetFilterViewModel.cs +++ b/src/Models/Facets/AlgoliaFacetFilterViewModel.cs @@ -1,6 +1,4 @@ -using Algolia.Search.Models.Search; - -using Kentico.Xperience.AlgoliaSearch.Attributes; +using Kentico.Xperience.AlgoliaSearch.Attributes; using Microsoft.Extensions.Localization; diff --git a/src/Services/Implementations/DefaultAlgoliaIndexingService.cs b/src/Services/Implementations/DefaultAlgoliaIndexingService.cs index a107039..4ee24f6 100644 --- a/src/Services/Implementations/DefaultAlgoliaIndexingService.cs +++ b/src/Services/Implementations/DefaultAlgoliaIndexingService.cs @@ -21,7 +21,7 @@ namespace Kentico.Xperience.AlgoliaSearch.Services { /// - /// Default implementation of . + /// Default implementation of . /// internal class DefaultAlgoliaIndexingService : IAlgoliaIndexingService { From 9a08a12b08608b79ce9d0cecad6e683b5aeb42f8 Mon Sep 17 00:00:00 2001 From: Sean Wright Date: Thu, 26 May 2022 17:37:17 -0400 Subject: [PATCH 3/7] chore(sln): internal c# analyzer fixes --- tests/Fakes/FakeNodes.cs | 2 +- tests/Tests/IAlgoliaSearchServiceTests.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Fakes/FakeNodes.cs b/tests/Fakes/FakeNodes.cs index 75436cf..c486d16 100644 --- a/tests/Fakes/FakeNodes.cs +++ b/tests/Fakes/FakeNodes.cs @@ -9,7 +9,7 @@ namespace Kentico.Xperience.AlgoliaSearch.Test { internal class FakeNodes { - private static Dictionary nodes = new Dictionary(); + private static readonly Dictionary nodes = new Dictionary(); public static string DOCTYPE_ARTICLE = "Test.Article"; diff --git a/tests/Tests/IAlgoliaSearchServiceTests.cs b/tests/Tests/IAlgoliaSearchServiceTests.cs index 49f43af..3573a88 100644 --- a/tests/Tests/IAlgoliaSearchServiceTests.cs +++ b/tests/Tests/IAlgoliaSearchServiceTests.cs @@ -31,7 +31,7 @@ public void GetFacetedAttributesTests_SetUp() } - private Dictionary> facetsFromResponse = new Dictionary>() + private readonly Dictionary> facetsFromResponse = new Dictionary>() { { "attr1", @@ -44,7 +44,7 @@ public void GetFacetedAttributesTests_SetUp() }; - private AlgoliaFacetedAttribute[] facetsFromFilter = new AlgoliaFacetedAttribute[] { + private readonly AlgoliaFacetedAttribute[] facetsFromFilter = new AlgoliaFacetedAttribute[] { new AlgoliaFacetedAttribute() { Attribute = "attr1", Facets = new AlgoliaFacet[] { From 06aa951f96bc41e5654c148037df3e56fbf92e7f Mon Sep 17 00:00:00 2001 From: Sean Wright Date: Thu, 26 May 2022 17:39:07 -0400 Subject: [PATCH 4/7] fix(lib): remove invalid public modifier on interfaces for C# 7.3 --- src/Kentico.Xperience.AlgoliaSearch.csproj | 1 + src/Models/Facets/IAlgoliaFacetFilter.cs | 4 ++-- src/Services/IAlgoliaConnection.cs | 8 ++++---- src/Services/IAlgoliaIndexingService.cs | 6 +++--- src/Services/IAlgoliaInsightsService.cs | 16 ++++++++-------- src/Services/IAlgoliaRegistrationService.cs | 19 ++++++++++--------- src/Services/IAlgoliaSearchService.cs | 10 +++++----- 7 files changed, 33 insertions(+), 31 deletions(-) diff --git a/src/Kentico.Xperience.AlgoliaSearch.csproj b/src/Kentico.Xperience.AlgoliaSearch.csproj index c6e7c8f..ca334ee 100644 --- a/src/Kentico.Xperience.AlgoliaSearch.csproj +++ b/src/Kentico.Xperience.AlgoliaSearch.csproj @@ -21,6 +21,7 @@ true true 1591 + 7.3 diff --git a/src/Models/Facets/IAlgoliaFacetFilter.cs b/src/Models/Facets/IAlgoliaFacetFilter.cs index c428a6c..ee91182 100644 --- a/src/Models/Facets/IAlgoliaFacetFilter.cs +++ b/src/Models/Facets/IAlgoliaFacetFilter.cs @@ -15,7 +15,7 @@ public interface IAlgoliaFacetFilter /// /// A collection of an Algolia index's faceted attributes and the available facets. /// - public abstract AlgoliaFacetedAttribute[] FacetedAttributes + AlgoliaFacetedAttribute[] FacetedAttributes { get; set; @@ -28,7 +28,7 @@ public abstract AlgoliaFacetedAttribute[] FacetedAttributes /// /// The Algolia search model that is being used in /// the current query. If null, all facet filters will use the "OR" condition. - public string GetFilter(Type searchModelType = null); + string GetFilter(Type searchModelType = null); /// diff --git a/src/Services/IAlgoliaConnection.cs b/src/Services/IAlgoliaConnection.cs index 1fb5f2c..6264f31 100644 --- a/src/Services/IAlgoliaConnection.cs +++ b/src/Services/IAlgoliaConnection.cs @@ -23,7 +23,7 @@ public interface IAlgoliaConnection /// or null. /// Thrown if the search model is configured /// incorrectly or index settings cannot be loaded. - public void Initialize(string indexName); + void Initialize(string indexName); /// @@ -33,7 +33,7 @@ public interface IAlgoliaConnection /// /// The Algolia internal IDs of the records to delete. /// The number of records deleted. - public int DeleteRecords(IEnumerable objectIds); + int DeleteRecords(IEnumerable objectIds); /// @@ -44,7 +44,7 @@ public interface IAlgoliaConnection /// Logs an error if there are issues loading the node data. /// The objects to upsert into Algolia. /// The number of objects processed. - public int UpsertRecords(IEnumerable dataObjects); + int UpsertRecords(IEnumerable dataObjects); /// @@ -53,6 +53,6 @@ public interface IAlgoliaConnection /// /// Thrown if a search model class is not /// found for the index. - public void Rebuild(); + void Rebuild(); } } diff --git a/src/Services/IAlgoliaIndexingService.cs b/src/Services/IAlgoliaIndexingService.cs index 1fefb74..6e74089 100644 --- a/src/Services/IAlgoliaIndexingService.cs +++ b/src/Services/IAlgoliaIndexingService.cs @@ -23,7 +23,7 @@ public interface IAlgoliaIndexingService /// The that triggered the event. /// True if the was deleted. /// True if the was created. - public void EnqueueAlgoliaItems(TreeNode node, bool wasDeleted, bool isNew); + void EnqueueAlgoliaItems(TreeNode node, bool wasDeleted, bool isNew); /// @@ -36,7 +36,7 @@ public interface IAlgoliaIndexingService /// A with its properties and values set. /// Thrown if or /// are null. - public JObject GetTreeNodeData(TreeNode node, Type searchModelType); + JObject GetTreeNodeData(TreeNode node, Type searchModelType); /// @@ -47,6 +47,6 @@ public interface IAlgoliaIndexingService /// Logs errors if there are issues initializing the . /// The items to process. /// The number of items processed. - public int ProcessAlgoliaTasks(IEnumerable items); + int ProcessAlgoliaTasks(IEnumerable items); } } diff --git a/src/Services/IAlgoliaInsightsService.cs b/src/Services/IAlgoliaInsightsService.cs index 9029b78..27247d5 100644 --- a/src/Services/IAlgoliaInsightsService.cs +++ b/src/Services/IAlgoliaInsightsService.cs @@ -23,7 +23,7 @@ public interface IAlgoliaInsightsService /// /// The response from Algolia, or null if the request was skipped or an error occurred communicating /// with Algolia. - public Task LogSearchResultClicked(string eventName, string indexName); + Task LogSearchResultClicked(string eventName, string indexName); /// @@ -32,7 +32,7 @@ public interface IAlgoliaInsightsService /// /// The response from Algolia, or null if the request was skipped or an error occurred communicating /// with Algolia. - public Task LogSearchResultConversion(string conversionName, string indexName); + Task LogSearchResultConversion(string conversionName, string indexName); /// @@ -44,7 +44,7 @@ public interface IAlgoliaInsightsService /// The code name of the Algolia index. /// The response from Algolia, or null if the request was skipped or an error occurred communicating /// with Algolia. - public Task LogPageConversion(int documentId, string conversionName, string indexName); + Task LogPageConversion(int documentId, string conversionName, string indexName); /// @@ -57,7 +57,7 @@ public interface IAlgoliaInsightsService /// The code name of the Algolia index. /// The response from Algolia, or null if the request was skipped or an error occurred communicating /// with Algolia. - public Task LogPageViewed(int documentId, string eventName, string indexName); + Task LogPageViewed(int documentId, string eventName, string indexName); /// @@ -68,7 +68,7 @@ public interface IAlgoliaInsightsService /// The code name of the Algolia index. /// The response from Algolia, or null if the request was skipped or an error occurred communicating /// with Algolia. - public Task LogFacetsViewed(IEnumerable facets, string eventName, string indexName); + Task LogFacetsViewed(IEnumerable facets, string eventName, string indexName); /// @@ -79,7 +79,7 @@ public interface IAlgoliaInsightsService /// The code name of the Algolia index. /// The response from Algolia, or null if the request was skipped or an error occurred communicating /// with Algolia. - public Task LogFacetClicked(string facet, string eventName, string indexName); + Task LogFacetClicked(string facet, string eventName, string indexName); /// @@ -90,7 +90,7 @@ public interface IAlgoliaInsightsService /// The code name of the Algolia index. /// The response from Algolia, or null if the request was skipped or an error occurred communicating /// with Algolia. - public Task LogFacetConverted(string facet, string conversionName, string indexName); + Task LogFacetConverted(string facet, string conversionName, string indexName); /// @@ -99,6 +99,6 @@ public interface IAlgoliaInsightsService /// /// The type of the Algolia search model. /// The full response of an Algolia search. - public void SetInsightsUrls(SearchResponse searchResponse) where TModel : AlgoliaSearchModel; + void SetInsightsUrls(SearchResponse searchResponse) where TModel : AlgoliaSearchModel; } } diff --git a/src/Services/IAlgoliaRegistrationService.cs b/src/Services/IAlgoliaRegistrationService.cs index 0ec2b90..a59704b 100644 --- a/src/Services/IAlgoliaRegistrationService.cs +++ b/src/Services/IAlgoliaRegistrationService.cs @@ -1,4 +1,5 @@ -using Algolia.Search.Models.Settings; +using Algolia.Search.Clients; +using Algolia.Search.Models.Settings; using CMS.DocumentEngine; @@ -20,7 +21,7 @@ public interface IAlgoliaRegistrationService /// A collection of registered Algolia indexes as identified by the /// in the search model class. /// - public List RegisteredIndexes + List RegisteredIndexes { get; } @@ -31,7 +32,7 @@ public List RegisteredIndexes /// /// Logs an error if the were issues scanning the assembly. /// The assembly to scan for attributes. - public IEnumerable GetAlgoliaIndexAttributes(Assembly assembly); + IEnumerable GetAlgoliaIndexAttributes(Assembly assembly); /// @@ -40,7 +41,7 @@ public List RegisteredIndexes /// The Algolia index code name. /// The index settings, or null if not found. /// - public IndexSettings GetIndexSettings(string indexName); + IndexSettings GetIndexSettings(string indexName); /// @@ -51,7 +52,7 @@ public List RegisteredIndexes /// /// The code name of the Algolia index. /// The names of the database columns that are indexed, or an empty array. - public string[] GetIndexedColumnNames(string indexName); + string[] GetIndexedColumnNames(string indexName); /// @@ -59,7 +60,7 @@ public List RegisteredIndexes /// /// The to check for indexing. /// - public bool IsNodeAlgoliaIndexed(TreeNode node); + bool IsNodeAlgoliaIndexed(TreeNode node); /// @@ -70,7 +71,7 @@ public List RegisteredIndexes /// The node to check for indexing. /// The Algolia index code name. /// - public bool IsNodeIndexedByIndex(TreeNode node, string indexName); + bool IsNodeIndexedByIndex(TreeNode node, string indexName); /// @@ -80,7 +81,7 @@ public List RegisteredIndexes /// based on the attributes defined in the search model. /// /// Logs an error if the index settings cannot be loaded. - public void RegisterAlgoliaIndexes(); + void RegisterAlgoliaIndexes(); /// @@ -89,6 +90,6 @@ public List RegisteredIndexes /// Logs errors if the parameters are invalid, or the index is already registered. /// The defined /// in the search model code file. - public void RegisterIndex(RegisterAlgoliaIndexAttribute registerAlgoliaIndexAttribute); + void RegisterIndex(RegisterAlgoliaIndexAttribute registerAlgoliaIndexAttribute); } } diff --git a/src/Services/IAlgoliaSearchService.cs b/src/Services/IAlgoliaSearchService.cs index 947c34e..69d7571 100644 --- a/src/Services/IAlgoliaSearchService.cs +++ b/src/Services/IAlgoliaSearchService.cs @@ -19,7 +19,7 @@ public interface IAlgoliaSearchService /// Gets the indices of the Algolia application with basic statistics. /// /// See - public List GetStatistics(); + List GetStatistics(); /// @@ -33,7 +33,7 @@ public interface IAlgoliaSearchService /// to the returned list with a count of zero. /// A new list of s that are available to filter search /// results. - public AlgoliaFacetedAttribute[] GetFacetedAttributes(Dictionary> facetsFromResponse, IAlgoliaFacetFilter filter = null, bool displayEmptyFacets = true); + AlgoliaFacetedAttribute[] GetFacetedAttributes(Dictionary> facetsFromResponse, IAlgoliaFacetFilter filter = null, bool displayEmptyFacets = true); /// @@ -45,13 +45,13 @@ public interface IAlgoliaSearchService /// Thrown if the /// has both and /// set to true. - public string GetFilterablePropertyName(PropertyInfo property); + string GetFilterablePropertyName(PropertyInfo property); /// /// Returns true if Algolia indexing is enabled, or if the settings key doesn't exist. /// - public bool IsIndexingEnabled(); + bool IsIndexingEnabled(); /// @@ -62,6 +62,6 @@ public interface IAlgoliaSearchService /// The properties of the search model to be ordered. /// A list of strings appropriate for setting Algolia searchable attributes (see /// ). - public List OrderSearchableProperties(IEnumerable searchableProperties); + List OrderSearchableProperties(IEnumerable searchableProperties); } } From 97417cb2634dc98c09caa5537227be676638f39a Mon Sep 17 00:00:00 2001 From: Sean Wright Date: Thu, 26 May 2022 17:42:25 -0400 Subject: [PATCH 5/7] feat(lib): add IAlgoliaIndexSearch as index customization point --- src/Services/IAlgoliaIndexService.cs | 17 +++++++++++++ .../DefaultAlgoliaIndexService.cs | 25 +++++++++++++++++++ .../DefaultAlgoliaRegistrationService.cs | 11 +++++--- .../Tests/IAlgoliaRegistrationServiceTests.cs | 11 ++++---- 4 files changed, 55 insertions(+), 9 deletions(-) create mode 100644 src/Services/IAlgoliaIndexService.cs create mode 100644 src/Services/Implementations/DefaultAlgoliaIndexService.cs diff --git a/src/Services/IAlgoliaIndexService.cs b/src/Services/IAlgoliaIndexService.cs new file mode 100644 index 0000000..b8d3cd8 --- /dev/null +++ b/src/Services/IAlgoliaIndexService.cs @@ -0,0 +1,17 @@ +using Algolia.Search.Clients; + +namespace Kentico.Xperience.AlgoliaSearch.Services +{ + /// + /// Initializes instances + /// + public interface IAlgoliaIndexService + { + /// + /// Initializes a new for the given . + /// + /// + /// + ISearchIndex InitializeIndex(string indexName); + } +} \ No newline at end of file diff --git a/src/Services/Implementations/DefaultAlgoliaIndexService.cs b/src/Services/Implementations/DefaultAlgoliaIndexService.cs new file mode 100644 index 0000000..630c881 --- /dev/null +++ b/src/Services/Implementations/DefaultAlgoliaIndexService.cs @@ -0,0 +1,25 @@ +using Algolia.Search.Clients; +using CMS; +using CMS.Core; +using Kentico.Xperience.AlgoliaSearch.Services; + +[assembly: RegisterImplementation(typeof(IAlgoliaIndexService), typeof(DefaultAlgoliaIndexService), Lifestyle = Lifestyle.Singleton, Priority = RegistrationPriority.SystemDefault)] + +namespace Kentico.Xperience.AlgoliaSearch.Services +{ + /// + public class DefaultAlgoliaIndexService : IAlgoliaIndexService + { + private readonly ISearchClient searchClient; + + public DefaultAlgoliaIndexService(ISearchClient searchClient) + { + this.searchClient = searchClient; + } + + public ISearchIndex InitializeIndex(string indexName) + { + return searchClient.InitIndex(indexName); + } + } +} \ No newline at end of file diff --git a/src/Services/Implementations/DefaultAlgoliaRegistrationService.cs b/src/Services/Implementations/DefaultAlgoliaRegistrationService.cs index 5c6abeb..3b3b7e9 100644 --- a/src/Services/Implementations/DefaultAlgoliaRegistrationService.cs +++ b/src/Services/Implementations/DefaultAlgoliaRegistrationService.cs @@ -25,8 +25,9 @@ internal class DefaultAlgoliaRegistrationService : IAlgoliaRegistrationService private readonly IAlgoliaSearchService algoliaSearchService; private readonly IEventLogService eventLogService; private readonly ISearchClient searchClient; - private List mRegisteredIndexes = new List(); - private string[] ignoredPropertiesForTrackingChanges = new string[] { + private readonly IAlgoliaIndexService algoliaIndexService; + private readonly List mRegisteredIndexes = new List(); + private readonly string[] ignoredPropertiesForTrackingChanges = new string[] { nameof(AlgoliaSearchModel.ObjectID), nameof(AlgoliaSearchModel.Url), nameof(AlgoliaSearchModel.ClassName) @@ -47,11 +48,13 @@ public List RegisteredIndexes /// public DefaultAlgoliaRegistrationService(IAlgoliaSearchService algoliaSearchService, IEventLogService eventLogService, - ISearchClient searchClient) + ISearchClient searchClient, + IAlgoliaIndexService algoliaIndexService) { this.algoliaSearchService = algoliaSearchService; this.eventLogService = eventLogService; this.searchClient = searchClient; + this.algoliaIndexService = algoliaIndexService; } @@ -220,7 +223,7 @@ public void RegisterAlgoliaIndexes() { RegisterIndex(attribute); - var searchIndex = searchClient.InitIndex(attribute.IndexName); + var searchIndex = algoliaIndexService.InitializeIndex(attribute.IndexName); var indexSettings = GetIndexSettings(attribute.IndexName); if (indexSettings == null) { diff --git a/tests/Tests/IAlgoliaRegistrationServiceTests.cs b/tests/Tests/IAlgoliaRegistrationServiceTests.cs index 12965f1..77f286d 100644 --- a/tests/Tests/IAlgoliaRegistrationServiceTests.cs +++ b/tests/Tests/IAlgoliaRegistrationServiceTests.cs @@ -31,7 +31,8 @@ public void GetIndexSettingsTests_SetUp() { var mockSearchClient = Substitute.For(); var algoliaSearchService = new DefaultAlgoliaSearchService(mockSearchClient); - algoliaRegistrationService = new DefaultAlgoliaRegistrationService(algoliaSearchService, new MockEventLogService(), mockSearchClient); + var mockIndexService = Substitute.For(); + algoliaRegistrationService = new DefaultAlgoliaRegistrationService(algoliaSearchService, new MockEventLogService(), mockSearchClient, mockIndexService); var attributes = algoliaRegistrationService.GetAlgoliaIndexAttributes(Assembly.GetExecutingAssembly()); foreach (var attribute in attributes) @@ -114,7 +115,7 @@ internal class IsNodeAlgoliaIndexed : AlgoliaTests [SetUp] public void IsNodeAlgoliaIndexed_SetUp() { - algoliaRegistrationService = new DefaultAlgoliaRegistrationService(Substitute.For(), new MockEventLogService(), Substitute.For()); + algoliaRegistrationService = new DefaultAlgoliaRegistrationService(Substitute.For(), new MockEventLogService(), Substitute.For(), Substitute.For()); var attributes = algoliaRegistrationService.GetAlgoliaIndexAttributes(Assembly.GetExecutingAssembly()); foreach (var attribute in attributes) @@ -153,7 +154,7 @@ internal class IsNodeIndexedByIndexTests : AlgoliaTests [SetUp] public void IsNodeIndexedByIndexTests_SetUp() { - algoliaRegistrationService = new DefaultAlgoliaRegistrationService(Substitute.For(), new MockEventLogService(), Substitute.For()); + algoliaRegistrationService = new DefaultAlgoliaRegistrationService(Substitute.For(), new MockEventLogService(), Substitute.For(), Substitute.For()); var attributes = algoliaRegistrationService.GetAlgoliaIndexAttributes(Assembly.GetExecutingAssembly()); foreach (var attribute in attributes) @@ -228,7 +229,7 @@ internal class GetIndexedColumnNamesTests : AlgoliaTests [SetUp] public void GetIndexedColumnNamesTests_SetUp() { - algoliaRegistrationService = new DefaultAlgoliaRegistrationService(Substitute.For(), new MockEventLogService(), Substitute.For()); + algoliaRegistrationService = new DefaultAlgoliaRegistrationService(Substitute.For(), new MockEventLogService(), Substitute.For(), Substitute.For()); var attributes = algoliaRegistrationService.GetAlgoliaIndexAttributes(Assembly.GetExecutingAssembly()); foreach (var attribute in attributes) @@ -262,7 +263,7 @@ internal class RegisterIndexTests : AlgoliaTests [SetUp] public void RegisterIndexTests_SetUp() { - algoliaRegistrationService = new DefaultAlgoliaRegistrationService(Substitute.For(), new MockEventLogService(), Substitute.For()); + algoliaRegistrationService = new DefaultAlgoliaRegistrationService(Substitute.For(), new MockEventLogService(), Substitute.For(), Substitute.For()); } From 5c9536172c30e2b0661f8a206893176c2f406c54 Mon Sep 17 00:00:00 2001 From: Eric Dugre Date: Wed, 1 Jun 2022 19:07:52 -0400 Subject: [PATCH 6/7] update README and custom module to use new interface --- .../Kentico.Xperience.AlgoliaSearch.1.0.1.zip | Bin 18220 -> 0 bytes .../Pages/AlgoliaSearch_Preview.aspx.cs | 8 ++++---- README.md | 18 +++++++++--------- src/AlgoliaQueueWorker.cs | 2 +- src/AlgoliaStartupExtensions.cs | 2 +- src/Kentico.Xperience.AlgoliaSearch.csproj | 2 +- src/Services/IAlgoliaIndexService.cs | 5 ++--- .../DefaultAlgoliaIndexService.cs | 13 +++++++++++-- 8 files changed, 29 insertions(+), 21 deletions(-) delete mode 100644 CMS/CMSModules/Kentico.Xperience.AlgoliaSearch/Kentico.Xperience.AlgoliaSearch.1.0.1.zip diff --git a/CMS/CMSModules/Kentico.Xperience.AlgoliaSearch/Kentico.Xperience.AlgoliaSearch.1.0.1.zip b/CMS/CMSModules/Kentico.Xperience.AlgoliaSearch/Kentico.Xperience.AlgoliaSearch.1.0.1.zip deleted file mode 100644 index 57ca59a3db24381cc46db564df7991cfb431c0bb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18220 zcmd6OWpo_da`lLrnVBtSu$UPwh7mI}vn*z2v}Ca?X0Vu<*oery^%( z?DEHb|GbppKQ3kX>!pf7v-hk1a!y|q=wxna2Xr)M06N*bGZ;BBn7G^9IXd@itU9i8 zAp6`!y@9Cl8hwqY;XF&UW340mlC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CMSModules/Kentico.Xperience.AlgoliaSearch/Pages/AlgoliaSearch_Preview.aspx.cs b/CMS/CMSModules/Kentico.Xperience.AlgoliaSearch/Pages/AlgoliaSearch_Preview.aspx.cs index cdee5da..2796344 100644 --- a/CMS/CMSModules/Kentico.Xperience.AlgoliaSearch/Pages/AlgoliaSearch_Preview.aspx.cs +++ b/CMS/CMSModules/Kentico.Xperience.AlgoliaSearch/Pages/AlgoliaSearch_Preview.aspx.cs @@ -1,5 +1,5 @@ -using Algolia.Search.Clients; -using Algolia.Search.Models.Search; +using Algolia.Search.Models.Search; + using CMS.Core; using CMS.Helpers; @@ -34,8 +34,8 @@ protected override void OnLoad(EventArgs e) string searchText = QueryHelper.GetString("searchtext", ""); if (!string.IsNullOrEmpty(searchText)) { - var client = Service.Resolve(); - var searchIndex = client.InitIndex(indexName); + var searchIndexService = Service.Resolve(); + var searchIndex = searchIndexService.InitializeIndex(indexName); if (searchIndex == null) { ShowError("Error loading search index. Please check the Event Log for more details."); diff --git a/README.md b/README.md index 5e6a0f3..b5212a3 100644 --- a/README.md +++ b/README.md @@ -311,21 +311,21 @@ public string Thumbnail { get; set; } ## :mag_right: Implementing the search interface -You can use Algolia's [.NET API](https://www.algolia.com/doc/api-client/getting-started/what-is-the-api-client/csharp/?client=csharp), [JavaScript API](https://www.algolia.com/doc/api-client/getting-started/what-is-the-api-client/javascript/?client=javascript), or [InstantSearch.js](https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/) to implement a search interface on your live site. The following example will help you with creating a search interface for .NET Core. In your Controllers, you can get a `SearchIndex` object by injecting the `ISearchClient` interface and calling the `InitIndex()` method on the client using your index's code name. Then, construct a `Query` to search the Algolia index. Algolia's pagination is zero-based, so in the Dancing Goat sample project we subtract 1 from the current page number: +You can use Algolia's [.NET API](https://www.algolia.com/doc/api-client/getting-started/what-is-the-api-client/csharp/?client=csharp), [JavaScript API](https://www.algolia.com/doc/api-client/getting-started/what-is-the-api-client/javascript/?client=javascript), or [InstantSearch.js](https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/) to implement a search interface on your live site. The following example will help you with creating a search interface for .NET Core. In your Controllers, you can get a `SearchIndex` object by injecting the `IAlgoliaIndexService` interface and calling the `InitializeIndex()` method on the client using your index's code name. Then, construct a `Query` to search the Algolia index. Algolia's pagination is zero-based, so in the Dancing Goat sample project we subtract 1 from the current page number: ```cs -private readonly ISearchClient _searchClient; +private readonly IAlgoliaIndexService _indexService; -public SearchController(ISearchClient searchClient) +public SearchController(IAlgoliaIndexService indexService) { - _searchClient = searchClient; + _indexService = indexService; } public ActionResult Search(string searchText, int page = DEFAULT_PAGE_NUMBER) { page = Math.Max(page, DEFAULT_PAGE_NUMBER); - var searchIndex = _searchClient.InitIndex(AlgoliaSiteSearchModel.IndexName); + var searchIndex = _indexService.InitializeIndex(AlgoliaSiteSearchModel.IndexName); var query = new Query(searchText) { Page = page - 1, @@ -552,7 +552,7 @@ As the search interface can be designed in multiple languages using Algolia's AP The Dancing Goat store doesn't use search out-of-the-box, so first you need to hook it up to Algolia. In this example, the search model seen in [Determining which pages to index](#determining-which-pages-to-index) will be used. -1. Inject `ISearchClient` into the `CoffeesController` as shown in [this section](#mag_right-implementing-the-search-interface). +1. Inject `IAlgoliaIndexService` into the `CoffeesController` as shown in [this section](#mag_right-implementing-the-search-interface). 2. In __CoffeesController.cs__, create a method that will perform a standard Algolia search. In the `Query.Filters` property, add a filter to only retrieve records where `ClassName` is `DancingGoatCore.Coffee.` You also specify which `Facets` you want to retrieve, but they are not used yet. @@ -571,7 +571,7 @@ private SearchResponse Search() Facets = facetsToRetrieve }; - var searchIndex = _searchClient.InitIndex(AlgoliaSiteSearchModel.IndexName); + var searchIndex = _indexService.InitializeIndex(AlgoliaSiteSearchModel.IndexName); return searchIndex.Search(query); } ``` @@ -700,7 +700,7 @@ private SearchResponse Search(IAlgoliaFacetFilter filter Facets = facetsToRetrieve }; - var searchIndex = _searchClient.InitIndex(AlgoliaSiteSearchModel.IndexName); + var searchIndex = _indexService.InitializeIndex(AlgoliaSiteSearchModel.IndexName); return searchIndex.Search(query); } ``` @@ -1256,7 +1256,7 @@ While the Xperience Algolia integration works without any changes to the Xperien ### Importing the custom module -1. Download the latest _Kentico.Xperience.AlgoliaSearch_ ZIP package in the [/CMS/CMSModules/Kentico.Xperience.AlgoliaSearch](/CMS/CMSModules/Kentico.Xperience.AlgoliaSearch) directory +1. Download the _Kentico.Xperience.AlgoliaSearch_ ZIP package by locating the latest "Custom module" [Release](https://github.com/Kentico/xperience-algolia/releases). 1. In the Xperience adminstration, open the __Sites__ application. 1. [Import](https://docs.xperience.io/deploying-websites/exporting-and-importing-sites/importing-a-site-or-objects) the downloaded package with the __Import files__ and __Import code files__ [settings](https://docs.xperience.io/deploying-websites/exporting-and-importing-sites/importing-a-site-or-objects#Importingasiteorobjects-Import-Objectselectionsettings) enabled. 1. Perform the [necessary steps](https://docs.xperience.io/deploying-websites/exporting-and-importing-sites/importing-a-site-or-objects#Importingasiteorobjects-Importingpackageswithfiles) to include the following imported folder in your project: diff --git a/src/AlgoliaQueueWorker.cs b/src/AlgoliaQueueWorker.cs index f849b43..7d1ba3a 100644 --- a/src/AlgoliaQueueWorker.cs +++ b/src/AlgoliaQueueWorker.cs @@ -36,7 +36,7 @@ public AlgoliaQueueWorker() /// /// Adds an to the worker queue to be processed. /// - /// + /// The item to be added to the queue. public static void EnqueueAlgoliaQueueItem(AlgoliaQueueItem queueItem) { if (queueItem == null || queueItem.Node == null || String.IsNullOrEmpty(queueItem.IndexName)) diff --git a/src/AlgoliaStartupExtensions.cs b/src/AlgoliaStartupExtensions.cs index 7e7e3e6..c88cb04 100644 --- a/src/AlgoliaStartupExtensions.cs +++ b/src/AlgoliaStartupExtensions.cs @@ -18,7 +18,7 @@ public static class AlgoliaStartupExtensions /// Registers instances of and /// with Dependency Injection. /// - /// + /// The service collection. /// The application configuration. public static IServiceCollection AddAlgolia(this IServiceCollection services, IConfiguration configuration) { diff --git a/src/Kentico.Xperience.AlgoliaSearch.csproj b/src/Kentico.Xperience.AlgoliaSearch.csproj index ca334ee..91b19cd 100644 --- a/src/Kentico.Xperience.AlgoliaSearch.csproj +++ b/src/Kentico.Xperience.AlgoliaSearch.csproj @@ -9,7 +9,7 @@ Xperience Algolia Search Kentico.Xperience.AlgoliaSearch - 2.1.0 + 2.2.0 Kentico Software Kentico Software icon.png diff --git a/src/Services/IAlgoliaIndexService.cs b/src/Services/IAlgoliaIndexService.cs index b8d3cd8..addd20b 100644 --- a/src/Services/IAlgoliaIndexService.cs +++ b/src/Services/IAlgoliaIndexService.cs @@ -3,15 +3,14 @@ namespace Kentico.Xperience.AlgoliaSearch.Services { /// - /// Initializes instances + /// Initializes instances. /// public interface IAlgoliaIndexService { /// /// Initializes a new for the given . /// - /// - /// + /// The code name of the index. ISearchIndex InitializeIndex(string indexName); } } \ No newline at end of file diff --git a/src/Services/Implementations/DefaultAlgoliaIndexService.cs b/src/Services/Implementations/DefaultAlgoliaIndexService.cs index 630c881..6b3d50d 100644 --- a/src/Services/Implementations/DefaultAlgoliaIndexService.cs +++ b/src/Services/Implementations/DefaultAlgoliaIndexService.cs @@ -1,22 +1,31 @@ using Algolia.Search.Clients; + using CMS; using CMS.Core; + using Kentico.Xperience.AlgoliaSearch.Services; [assembly: RegisterImplementation(typeof(IAlgoliaIndexService), typeof(DefaultAlgoliaIndexService), Lifestyle = Lifestyle.Singleton, Priority = RegistrationPriority.SystemDefault)] - namespace Kentico.Xperience.AlgoliaSearch.Services { - /// + /// + /// Default implementation of which simply calls + /// . + /// public class DefaultAlgoliaIndexService : IAlgoliaIndexService { private readonly ISearchClient searchClient; + + /// + /// Initializes a new instance of the class. + /// public DefaultAlgoliaIndexService(ISearchClient searchClient) { this.searchClient = searchClient; } + public ISearchIndex InitializeIndex(string indexName) { return searchClient.InitIndex(indexName); From d071f0a8ae65a65df360485197f9386234cce942 Mon Sep 17 00:00:00 2001 From: Eric Dugre Date: Thu, 2 Jun 2022 12:24:50 -0400 Subject: [PATCH 7/7] mark DefaultAlgoliaIndexService internal --- src/Services/Implementations/DefaultAlgoliaIndexService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Services/Implementations/DefaultAlgoliaIndexService.cs b/src/Services/Implementations/DefaultAlgoliaIndexService.cs index 6b3d50d..4e6cdf6 100644 --- a/src/Services/Implementations/DefaultAlgoliaIndexService.cs +++ b/src/Services/Implementations/DefaultAlgoliaIndexService.cs @@ -12,7 +12,7 @@ namespace Kentico.Xperience.AlgoliaSearch.Services /// Default implementation of which simply calls /// . /// - public class DefaultAlgoliaIndexService : IAlgoliaIndexService + internal class DefaultAlgoliaIndexService : IAlgoliaIndexService { private readonly ISearchClient searchClient;