By default, the number of returned documents is limited to **10,000** **for a single search**, which is the normal behavior for many search engines. Using pagination ("skip and take"), you can display a maximum of **10 pages**, with a maximum of **1,000 documents** per page by default.
Similar to [LINQ](🔗), the Optimizely Search & Navigation .NET API has `Skip
` and `Take
`Â methods to bypass (Skip) the number of search results and specify how many search results should be returned (Take).
Note
You cannot combine `
Skip
` and `Take
` to retrieve more than 10,000 hits in a single search. For performance reasons, Optimizely Search & Navigation is not intended for retrieving all content from the database in real-time, with deep pagination.
The maximum value that can be specified using the `Take
` method is 1,000. In other words, `Take(1001)
` or `Take(int.MaxValue)
` throws an exception. If more than a thousand result items are needed, use [multiple search requests](🔗).
The following example uses the `Skip
` and `Take
` methods for pagination.
Sometimes, visitors get duplicate hits on pagination because different shards answer the same query. To make sure this does not happen, use the `UsePreference
` method. By default, the `UsePreference
` method does not use the `PrimaryFirst
` option, so in rare cases, visitors may still get duplicate hits. (although it has better performance). Using the `UsePreference
` method with the `PrimaryFirst
` option prevents duplicate hits completely, but sometimes, the query can be slower than usual.
The following example uses `UsePreference
` method for pagination.