diff --git a/src/Testsites/Our.Umbraco.FullTextSearch.Testsite14/Views/Partials/Search.cshtml b/src/Testsites/Our.Umbraco.FullTextSearch.Testsite14/Views/Partials/Search.cshtml new file mode 100644 index 0000000..7a6e1a1 --- /dev/null +++ b/src/Testsites/Our.Umbraco.FullTextSearch.Testsite14/Views/Partials/Search.cshtml @@ -0,0 +1,55 @@ +@inject Our.Umbraco.FullTextSearch.Interfaces.ISearchService SearchService +@using Our.Umbraco.FullTextSearch.Models +@using System.Web +@using Umbraco.Extensions +@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage + + +
+
+
+ Search + + +
+
+ +@if (Context.Request.Query["q"].ToString() is string searchQuery && searchQuery.IsNullOrWhiteSpace() == false) +{ + var currentPage = int.TryParse(Context.Request.Query["p"], out var p) ? p : 1; + var search = new Search(searchQuery); + var results = SearchService.Search(search, currentPage); + +
+ Search Results for '@searchQuery' + +
@results.TotalResults results found
+ + + @if (currentPage > 1) + { + Previous page + } + @if (results.TotalPages > currentPage) + { + Next page + } +
+ +} +
\ No newline at end of file diff --git a/src/Testsites/Our.Umbraco.FullTextSearch.Testsite14/Views/home.cshtml b/src/Testsites/Our.Umbraco.FullTextSearch.Testsite14/Views/home.cshtml index a6167de..c2da91a 100644 --- a/src/Testsites/Our.Umbraco.FullTextSearch.Testsite14/Views/home.cshtml +++ b/src/Testsites/Our.Umbraco.FullTextSearch.Testsite14/Views/home.cshtml @@ -20,6 +20,8 @@ +@await Html.PartialAsync("Search") +
@await Html.GetBlockGridHtmlAsync(Model.BodyText)