Introduction
Similar to LINQ, the EPiServer Find .NET API has methods to
- Skip-bypass a specified number of search results then return the remaining results.
- Take-specify the number of search results to return
The Take Method
By default, Find returns 10 search results. Use the Take method to change that value up to a maximum of 1000. If the Take value exceeds 1000 (in other words, Take(1001) or Take(int.MaxValue)), an exception is thrown.
To return more than 1000 results, use multiple search requests.
Examples
Below is an example of using the Skip and Take methods for pagination:
C#
string searchQuery =
int page =
int pageSize = 15;
client.Search<BlogPost>()
.For(searchQuery)
.Skip((page - 1)*pageSize)
.Take(pageSize)
.GetResult();
Do you find this information helpful? Please log in to provide feedback.