Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I could not find out any overload of ISearcher.Search or IQueryExecutor.Execute that support returning paging.
Any idea about the search result's pagination with Umbraco 8?
Note that this is a custom search - I want to search on some specific document types.
Hi there :)
Check out this article: https://shazwazza.com/post/paging-with-examine/
Basically you need to set maxResults to the number of results per page (multiplied by the current pagenumber), and then skip through the ones you have already shown.
//for example purposes, we want to show page #4 (which is pageIndex of 3)
var pageIndex = 3;
//for this example, the page size is 10 items
var pageSize = 10;
var searchResult = searchProvider.Search(criteria,
//don't return more results than we need for the paging
//this is the 'trick' - we need to load enough search results to fill
//all pages from 1 to the current page of 4
maxResults: pageSize*(pageIndex + 1));
//then we use the Skip method to tell Lucene to not allocate search results
//for the first 3 pages
var pagedResults = searchResult.Skip(pageIndex*pageSize);
var totalResults = searchResult.TotalItemCount;
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted