Queryable datasource on sublayouts (presentation details)

Offcourse we all know that there is a way to set queryable datasources to sublayout definitions in the Sitecore database to help us select appropriate data for our renderings. This can be done using a module that you can find on the marketplace:


This module – when you specify a sitecore query – changes the rendering datasource to a new location. This can be very handy when you work with the page editor and want content of specific items to be placed underneath the content item itself. You can then for example place a “/content” folder underneath your items to hold the specific content that will be displayed on your item.

What I’ve noticed during development of a new Sitecore website that uses the page editor is that it can be very handy to have a complete page setup for our content editors so they see how a page should look. Giving the editors the ability to change existing layout is generally more appreciated than giving them a blank page that they have to fill from scratch everytime they add a new page / content item.

To achieve this goal we create a new “branch” for this set of items that will help our editors to quickly fill a new content item. This branch could for example have the following structure:


What you see here is a branch on which we have filled specific content items and other data template based items that will be used in our branch. When the content editor creates a new item from this branch, we wanted the presentation details of this branch to have those items preselected without having them  central /in a shared folder somewhere in Sitecore. Every branch would then create this structure and the item created would have it’s own items underneath that would be used in the presentation. This offcourse could be done with the same concept as we’ve seen before in the Queryable Datasource. We went to see how Sitecore actually determines what item to present in a sublayout and found out we could play a little with the “ProcessContextQuerySource” pipeline.

We did the following: (after decompiling the Sitecore.Kernel.dll)

  • Create a new processor definition in the config that replaces the ‘Sitecore.Pipelines.InsertRenderings.Processors.AddRenderings, Sitecore.Kernel’ pipeline.

  • Create a class that inherits “Sitecore.Pipelines.InsertRenderings.Processors.AddRenderings” and implement it using the following code:

Now when sitecore is adding renderings to the page and finds a rendering that has a query: in the datasource  it will be picked up as a special rendering. This class will extract all renderings with “query:” in it’s datasource and sets the appropriate datasource for those renderings. Pretty neat huh?

You can now add a sublayout on your branch item with the following query to set default text:


When the item is created from the branch it will initially point to the item underneath itself, but the content editor is free to change to another datasource if needed. When you click the ‘set associated content’ button the usual stuff will happen, making sure that you can set different content as datasource.

I do realise that this concept is taken from the queryable datasource, tho I think that this might be useful to setup a branch with item specific data underneath the content item itself (without having to create shared content items somewhere to point at from the datasource).

That’s it for now!

Lucene MaxClauseCount error after upgrading to Sitecore 7.2 (rev. 140228)

After upgrading your solution from an early release of Sitecore 7 (ie. 7.0 / 7.1) you might get the following error:

Message: maxClauseCount is set to 1024
Source: Lucene.Net
bij Lucene.Net.Search.BooleanQuery.Add(BooleanClause clause)
bijLucene.Net.Search.MultiTermQuery.ScoringBooleanQueryRewrite.Rewrite(IndexReaderreader, MultiTermQuery query)
bij Lucene.Net.Search.Spans.SpanFirstQuery.Rewrite(IndexReader reader)
bij Lucene.Net.Search.BooleanQuery.Rewrite(IndexReader reader)
bij Lucene.Net.Search.BooleanQuery.Rewrite(IndexReader reader)
bij Lucene.Net.Search.IndexSearcher.Rewrite(Query original)

You can’t solve this by adjusting the setting:

in your Sitecore.ContentSearch.Lucene.DefaultIndexConfiguration.config file, but by adding the following lines of code to your SaerchProvider:

Somehow adjusting the setting in your config file won’t have any effect.