In today's Sitecore Tip of the Day we will examine how to control the limit on the number of items in a query result set.
NOTE: The setting that controls the maximum number of items returned in a Sitecore Query also controls the maximum number of items in Lookup, Multilist and Valuelookup fields.
In your site's 'web.config' file, under the node
/configuration/sitecore/settings you will find a
<setting name="Query.MaxItems" ...> note. The
value attribute of this node will determine the maximum number of items in a query result set. The default value of this node is
100, and setting the value of the node to
0 will effectively make the number of items unlimited. It should be noted that this can have a negative affect on system performance should a large query result be returned.
Note that this setting effects the
Sitecore.Data.Items.Item.Axes.SelectItems() query methods, as well as the other
Sitecore.Data.Items.Item.Axes query methods. Ideally, these methods should not be used against a large data set. In their documentation, Sitecore suggests "using a search index or another solution where the system must frequently match items in a large branch," instead of using Sitecore Queries against large volumes of data.