diff --git a/Dfe.Data.SearchPrototype/SearchForEstablishments/ByKeyword/Usecase/SearchByKeywordResponse.cs b/Dfe.Data.SearchPrototype/SearchForEstablishments/ByKeyword/Usecase/SearchByKeywordResponse.cs index a595788..37484bf 100644 --- a/Dfe.Data.SearchPrototype/SearchForEstablishments/ByKeyword/Usecase/SearchByKeywordResponse.cs +++ b/Dfe.Data.SearchPrototype/SearchForEstablishments/ByKeyword/Usecase/SearchByKeywordResponse.cs @@ -26,35 +26,17 @@ public sealed class SearchByKeywordResponse public SearchResponseStatus Status { get; } /// - /// Establishes the status of the underlying search response, i.e. Success or otherwise. + /// The Total Count returned from Establishment search gives us a total + /// of all available records which correlates with the given search criteria. /// - /// - public SearchByKeywordResponse(SearchResponseStatus status) - { - Status = status; - } + public int TotalNumberOfEstablishments { get; init; } /// - /// The following argument is passed via the constructor and is not changeable - /// once an instance is created, this ensures we preserve immutability. + /// Establishes the status of the underlying search response, i.e. Success or otherwise. /// - /// - /// The readonly collection of . - /// - /// - /// The readonly collection of . - /// - /// - /// The of the result of the search. - /// - public SearchByKeywordResponse( - EstablishmentResults establishments, - EstablishmentFacets facetResults, - SearchResponseStatus status - ) + /// + public SearchByKeywordResponse(SearchResponseStatus status) { - EstablishmentResults = establishments; - EstablishmentFacetResults = facetResults; Status = status; } } diff --git a/Dfe.Data.SearchPrototype/SearchForEstablishments/ByKeyword/Usecase/SearchByKeywordUseCase.cs b/Dfe.Data.SearchPrototype/SearchForEstablishments/ByKeyword/Usecase/SearchByKeywordUseCase.cs index f48540a..aeb79ac 100644 --- a/Dfe.Data.SearchPrototype/SearchForEstablishments/ByKeyword/Usecase/SearchByKeywordUseCase.cs +++ b/Dfe.Data.SearchPrototype/SearchForEstablishments/ByKeyword/Usecase/SearchByKeywordUseCase.cs @@ -87,7 +87,10 @@ await _searchServiceAdapter.SearchAsync( _ => new(status: SearchResponseStatus.Success) { EstablishmentResults = results.Establishments, - EstablishmentFacetResults = results.Facets + EstablishmentFacetResults = results.Facets, + TotalNumberOfEstablishments = + results.TotalNumberOfEstablishments.HasValue ? + (int)results.TotalNumberOfEstablishments : 0, // if not values default to zero. } }; }