diff --git a/Dfe.Data.SearchPrototype.sln b/Dfe.Data.SearchPrototype.sln index fafe9a5..971a9d6 100644 --- a/Dfe.Data.SearchPrototype.sln +++ b/Dfe.Data.SearchPrototype.sln @@ -9,8 +9,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dfe.Data.SearchPrototype.Te EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuGet", "NuGet", "{0D4ACC06-9FA9-422A-8F92-92B565879E16}" ProjectSection(SolutionItems) = preProject - NuGet\DfE.Data.ComponentLibrary.CrossCuttingConcerns.Json.2.0.37-beta-ci-20240610-104522.nupkg = NuGet\DfE.Data.ComponentLibrary.CrossCuttingConcerns.Json.2.0.37-beta-ci-20240610-104522.nupkg - NuGet\DfE.Data.ComponentLibrary.Infrastructure.CognitiveSearch.2.0.37-beta-ci-20240610-104522.nupkg = NuGet\DfE.Data.ComponentLibrary.Infrastructure.CognitiveSearch.2.0.37-beta-ci-20240610-104522.nupkg + NuGet\Dfe.Data.Common.Infrastructure.CognitiveSearch.1.0.0.nupkg = NuGet\Dfe.Data.Common.Infrastructure.CognitiveSearch.1.0.0.nupkg EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dfe.Data.SearchPrototype.Infrastructure", "Dfe.Data.SearchPrototype\Infrastructure\Dfe.Data.SearchPrototype.Infrastructure.csproj", "{95EDB119-5238-451B-944A-84A1F8891171}" diff --git a/Dfe.Data.SearchPrototype/Infrastructure/CognitiveSearchServiceAdapter.cs b/Dfe.Data.SearchPrototype/Infrastructure/CognitiveSearchServiceAdapter.cs index c084cf9..70aef74 100644 --- a/Dfe.Data.SearchPrototype/Infrastructure/CognitiveSearchServiceAdapter.cs +++ b/Dfe.Data.SearchPrototype/Infrastructure/CognitiveSearchServiceAdapter.cs @@ -1,10 +1,10 @@ using Azure; using Azure.Search.Documents; using Azure.Search.Documents.Models; +using Dfe.Data.Common.Infrastructure.CognitiveSearch.SearchByKeyword; using Dfe.Data.SearchPrototype.Common.Mappers; using Dfe.Data.SearchPrototype.Infrastructure.Options; using Dfe.Data.SearchPrototype.SearchForEstablishments; -using DfE.Data.ComponentLibrary.Infrastructure.CognitiveSearch.Search; namespace Dfe.Data.SearchPrototype.Infrastructure; @@ -14,7 +14,7 @@ namespace Dfe.Data.SearchPrototype.Infrastructure; /// public sealed class CognitiveSearchServiceAdapter : ISearchServiceAdapter where TSearchResult : class { - private readonly ISearchService _cognitiveSearchService; + private readonly ISearchByKeywordService _searchByKeywordService; private readonly ISearchOptionsFactory _searchOptionsFactory; private readonly IMapper>, EstablishmentResults> _searchResponseMapper; @@ -22,8 +22,8 @@ public sealed class CognitiveSearchServiceAdapter : ISearchServic /// The following dependencies include the core cognitive search service definition, /// the complete implementation of which is defined in the IOC container. /// - /// - /// Cognitive search service definition injected via IOC container. + /// + /// Cognitive search (search by keyword) service definition injected via IOC container. /// /// /// Factory class definition for prescribing the requested search options (by collection context). @@ -32,12 +32,12 @@ public sealed class CognitiveSearchServiceAdapter : ISearchServic /// Maps the raw azure search response to the required "T:Dfe.Data.SearchPrototype.Search.Domain.AgregateRoot.Establishments" /// public CognitiveSearchServiceAdapter( - ISearchService cognitiveSearchService, + ISearchByKeywordService searchByKeywordService, ISearchOptionsFactory searchOptionsFactory, IMapper>, EstablishmentResults> searchResponseMapper) { _searchOptionsFactory = searchOptionsFactory; - _cognitiveSearchService = cognitiveSearchService; + _searchByKeywordService = searchByKeywordService; _searchResponseMapper = searchResponseMapper; } @@ -65,7 +65,7 @@ public async Task SearchAsync(SearchContext searchContext) $"Search options cannot be derived for {searchContext.TargetCollection}."); Response> searchResults = - await _cognitiveSearchService.SearchAsync( + await _searchByKeywordService.SearchAsync( searchContext.SearchKeyword, searchContext.TargetCollection, searchOptions diff --git a/Dfe.Data.SearchPrototype/Infrastructure/Dfe.Data.SearchPrototype.Infrastructure.csproj b/Dfe.Data.SearchPrototype/Infrastructure/Dfe.Data.SearchPrototype.Infrastructure.csproj index 2443e5a..4e79f00 100644 --- a/Dfe.Data.SearchPrototype/Infrastructure/Dfe.Data.SearchPrototype.Infrastructure.csproj +++ b/Dfe.Data.SearchPrototype/Infrastructure/Dfe.Data.SearchPrototype.Infrastructure.csproj @@ -18,10 +18,10 @@ - + diff --git a/Dfe.Data.SearchPrototype/Infrastructure/Tests/CognitiveSearchServiceAdapterTests.cs b/Dfe.Data.SearchPrototype/Infrastructure/Tests/CognitiveSearchServiceAdapterTests.cs index 5545c16..6671aaf 100644 --- a/Dfe.Data.SearchPrototype/Infrastructure/Tests/CognitiveSearchServiceAdapterTests.cs +++ b/Dfe.Data.SearchPrototype/Infrastructure/Tests/CognitiveSearchServiceAdapterTests.cs @@ -1,10 +1,10 @@ using Azure; using Azure.Search.Documents.Models; +using Dfe.Data.Common.Infrastructure.CognitiveSearch.SearchByKeyword; using Dfe.Data.SearchPrototype.Common.Mappers; using Dfe.Data.SearchPrototype.Infrastructure.Options; using Dfe.Data.SearchPrototype.Infrastructure.Tests.TestDoubles; using Dfe.Data.SearchPrototype.SearchForEstablishments; -using DfE.Data.ComponentLibrary.Infrastructure.CognitiveSearch.Search; using FluentAssertions; using Moq; using Xunit; @@ -14,11 +14,11 @@ namespace Dfe.Data.SearchPrototype.Infrastructure.Tests; public sealed class CognitiveSearchServiceAdapterTests { private static CognitiveSearchServiceAdapter CreateServiceAdapterWith( - ISearchService cognitiveSearchService, + ISearchByKeywordService searchByKeywordService, ISearchOptionsFactory searchOptionsFactory, IMapper>, EstablishmentResults> searchResponseMapper ) => - new(cognitiveSearchService, searchOptionsFactory, searchResponseMapper); + new(searchByKeywordService, searchOptionsFactory, searchResponseMapper); [Fact] public async Task Search_With_Valid_SearchContext_Returns_Configured_Results() diff --git a/Dfe.Data.SearchPrototype/Infrastructure/Tests/TestDoubles/SearchServiceTestDouble.cs b/Dfe.Data.SearchPrototype/Infrastructure/Tests/TestDoubles/SearchServiceTestDouble.cs index 41ebebc..3e2da9b 100644 --- a/Dfe.Data.SearchPrototype/Infrastructure/Tests/TestDoubles/SearchServiceTestDouble.cs +++ b/Dfe.Data.SearchPrototype/Infrastructure/Tests/TestDoubles/SearchServiceTestDouble.cs @@ -1,7 +1,7 @@ using Azure; using Azure.Search.Documents; using Azure.Search.Documents.Models; -using DfE.Data.ComponentLibrary.Infrastructure.CognitiveSearch.Search; +using Dfe.Data.Common.Infrastructure.CognitiveSearch.SearchByKeyword; using Moq; using System.Linq.Expressions; @@ -9,13 +9,13 @@ namespace Dfe.Data.SearchPrototype.Infrastructure.Tests.TestDoubles; internal static class SearchServiceTestDouble { - public static ISearchService DefaultMock() => Mock.Of(); - public static Expression>>>> SearchRequest(string keyword, string collection) => + public static ISearchByKeywordService DefaultMock() => Mock.Of(); + public static Expression>>>> SearchRequest(string keyword, string collection) => searchService => searchService.SearchAsync(keyword, collection, It.IsAny()); - public static ISearchService MockFor(Task>> searchResult, string keyword, string collection) + public static ISearchByKeywordService MockFor(Task>> searchResult, string keyword, string collection) { - var searchServiceMock = new Mock(); + var searchServiceMock = new Mock(); searchServiceMock.Setup(SearchRequest(keyword, collection)) .Returns(searchResult); @@ -23,7 +23,7 @@ public static ISearchService MockFor(Task> return searchServiceMock.Object; } - public static ISearchService MockSearchService(string keyword, string collection) + public static ISearchByKeywordService MockSearchService(string keyword, string collection) { var responseMock = new Mock(); @@ -36,7 +36,7 @@ public static ISearchService MockSearchService(string keyword, string collection return MockFor(validServiceResponseFake, keyword, collection); } - public static ISearchService MockForDefaultResult() + public static ISearchByKeywordService MockForDefaultResult() { var validServiceResponseFake = Task.FromResult>>(default!); diff --git a/NuGet/DfE.Data.ComponentLibrary.CleanArchitecture.2.0.37-beta-ci-20240610-104522.nupkg b/NuGet/DfE.Data.ComponentLibrary.CleanArchitecture.2.0.37-beta-ci-20240610-104522.nupkg deleted file mode 100644 index d308eb3..0000000 Binary files a/NuGet/DfE.Data.ComponentLibrary.CleanArchitecture.2.0.37-beta-ci-20240610-104522.nupkg and /dev/null differ diff --git a/NuGet/DfE.Data.ComponentLibrary.CrossCuttingConcerns.Json.2.0.37-beta-ci-20240610-104522.nupkg b/NuGet/DfE.Data.ComponentLibrary.CrossCuttingConcerns.Json.2.0.37-beta-ci-20240610-104522.nupkg deleted file mode 100644 index 95d6dde..0000000 Binary files a/NuGet/DfE.Data.ComponentLibrary.CrossCuttingConcerns.Json.2.0.37-beta-ci-20240610-104522.nupkg and /dev/null differ diff --git a/NuGet/DfE.Data.ComponentLibrary.CrossCuttingConcerns.Mapping.2.0.37-beta-ci-20240610-104522.nupkg b/NuGet/DfE.Data.ComponentLibrary.CrossCuttingConcerns.Mapping.2.0.37-beta-ci-20240610-104522.nupkg deleted file mode 100644 index f528362..0000000 Binary files a/NuGet/DfE.Data.ComponentLibrary.CrossCuttingConcerns.Mapping.2.0.37-beta-ci-20240610-104522.nupkg and /dev/null differ diff --git a/NuGet/DfE.Data.ComponentLibrary.Infrastructure.CognitiveSearch.2.0.37-beta-ci-20240610-104522.nupkg b/NuGet/DfE.Data.ComponentLibrary.Infrastructure.CognitiveSearch.2.0.37-beta-ci-20240610-104522.nupkg deleted file mode 100644 index 9ad70e4..0000000 Binary files a/NuGet/DfE.Data.ComponentLibrary.Infrastructure.CognitiveSearch.2.0.37-beta-ci-20240610-104522.nupkg and /dev/null differ diff --git a/NuGet/Dfe.Data.Common.Infrastructure.CognitiveSearch.1.0.0.nupkg b/NuGet/Dfe.Data.Common.Infrastructure.CognitiveSearch.1.0.0.nupkg new file mode 100644 index 0000000..42d838d Binary files /dev/null and b/NuGet/Dfe.Data.Common.Infrastructure.CognitiveSearch.1.0.0.nupkg differ