Query Settings

Query Settings

Controls featured in this example:

  • Sitecore Web Control

Classes featured in this example:

  • Sitecore.Configuration.Settings
  • Sitecore.Configuration.Settings.Query
  • Sitecore.Context
  • Sitecore.Data.Items.Item

Query Configuration Settings

  • <configuration>
    • <sitecore>
      • <pipelines>
        • <httpRequestBegin>
          • <processor type="Sitecore.Pipelines.HttpRequest.QueryStringResolver, Sitecore.Kernel" />
        • <getLookupSourceItems>
          • <processor type="Sitecore.Pipelines.GetLookupSourceItems.ProcessQuerySource, Sitecore.Kernel" />
      • <settings>
        • <!-- Fast Query Descendants Disabled
                     Determines whether ability to select items through Ancestors/Descendants axes should be disabled in fast query.
                     Default value: false  -->
          • <setting name="FastQueryDescendantsDisabled" value="false" />
        • <!--  Query.MaxItems
                     Specifies the maximum number of items in a query result set
                     This also controls the number of items in Lookup, Multilist and Valuelookup fields
                     Default value: 100 -->
          • <setting name="Query.MaxItems" value="100" />

Query Settings C# Web Control Code

Sitecore.Data.Items.Item item = Sitecore.Context.Item;
if (item == null) return;

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold; width:100%; clear:both");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div);
output.Write("C# Web Control Output");
output.RenderEndTag();

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-size:x-small; width:100%; clear:both");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div);
output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.P);
//using &#58; for colon and &#63; for question mark and &#160; for space
output.Write("{0}&#58;&#160;{1}", "Item", item.DisplayName);
output.RenderEndTag(); //P

output.Write("{0}&#63;&#160;{1}", "Fast Query Descendants Disabled", "<b>" + Sitecore.Configuration.Settings.FastQueryDescendantsDisabled.ToString() + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Query Maximum Items", "<b>" + Sitecore.Configuration.Settings.Query.MaxItems.ToString() + "</b>");

output.RenderEndTag(); //Div

Query Settings C# Web Control Output

Item: Query Settings

Fast Query Descendants Disabled? False
Query Maximum Items: 0

Sources