Filter items without language version in Sitecore Item Web API

The Sitecore Item Web API is a great tool to query Sitecore client side and retrieve JSON data which can be shown through a JavaScript library like Angular or Knockout. The Item Web API will return all items that match a query even if there is no version of an item in the current language. This can lead to unnecessarily large HTTP responses which will slow down the page, especially in multilingual sites with many languages with different content per language.

One nice feature of Item Web API is the ability to easily customize it. Below simple pipeline can be added to filter out any item that matches a query but does not have a version in the current language:

using Sitecore.Diagnostics;
using Sitecore.ItemWebApi.Pipelines.Read;
using Sitecore.Web;
using System.Linq;

namespace Jeroen.Pipelines.WebAPI
    public class RemoveItemsWithoutLanguageVersion : ReadProcessor
        public override void Process(ReadArgs arguments)
            Assert.ArgumentNotNull(arguments, "arguments");

            if (WebUtil.GetQueryString("language-filter", null) == "1")
                arguments.Scope = arguments.Scope.Where(i => i.Versions.Count > 0).ToArray();

I’m only doing this filtering when a query string of language-filter=1 is passed. I add this to every query that needs it. This avoids any conflicts with existing functionality which uses Item Web API like the Sitecore Desktop. Above pipeline is enabled in Sitecore.ItemWebApi.config as follows:

   <processor type="Jeroen.Pipelines.WebAPI.RemoveItemsWithoutLanguageVersion, Jeroen.Pipelines" />

Avoid Sitecore performance degradation with SQL Azure

SQL Azure is a great choice for hosting Sitecore’s databases. Out of the box it provides many features like high uptime SLA, performance you can adjust easily based on demand and geo-replication. Since Sitecore 8 you can publish your databases to SQL Azure without any schema changes.

If you are using SQL Azure for a while you might notice that your Sitecore’s performance might go down over time especially at times when the database gets hit hard for example right after an application pool recycle. I initially had many incorrect assumptions regarding the source of these issues, I looked into prefetch cache, additional content, site traffic etc. Eventually i figured out that i had to update statistics and query plans which immediately resolved this issue.

This issue is not specifically related to Sitecore only but can be experienced with other technologies as well. However be sure to update statistics regularly to avoid any unnecessary performance issues in your site.

Sitecore upgrade from 8.0 to 8.1 without xDB

Sitecore recently released version 8.1, even without xDB there are some new exciting features introduced for example the new language fallback features and fully integrated IP Geolocation services. A more detailed list can be found here.

When you do not have xDB enabled and are upgrading from 8.0 to 8.1 then there is one setting that you will need to correctly update otherwise a number of things will most likely break without any clear indication what the root cause is.

In Sitecore 8.0 you had to follow this guide and disable the Analytics.Enabled setting. It is easy to assume that the same would apply to Sitecore 8.1. However in Sitecore 8.1 you’ll have to set CMS only mode by setting xDB.enabled to false in Sitecore.Xdb.config. You can verify xDB is correctly disabled by looking in the Sitecore log for a message like this “1234 17:21:20 INFO xDB is disabled.”

Hopefully this will help someone. Apart form this I found upgrading from 8.0 to 8.1 straightforward.