Try our conversational search powered by Generative AI!

Loading...
Area: Optimizely Search & Navigation
ARCHIVED This content is retired and no longer maintained. See the latest version here.

Recommended reading 

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 = //From query string or similar
int page = //From query string or similar
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.

Last updated: Feb 23, 2015

Recommended reading