Appending to the _content field in Sitecore Search 7.2 and 7.5

The _content field in Lucene for Sitecore is basically the full text index. If you index things like PDFs, Word documents, etc., then the results of the IFilter get stored in the _content field.

You can add computed fields into the _content field simply by specifying them with the name ‘_content’. However, I found some differences with how patch files behave. 

First off, let’s look at a simple computed field:

using Sitecore.ContentSearch;
using Sitecore.ContentSearch.ComputedFields;
using Sitecore.Data.Items;
namespace Example.Indexing
public class FullNameComputedField : IComputedIndexField
public string FieldName { get; set; }
public string ReturnType { get; set; }
public object ComputeFieldValue(IIndexable indexable)
Item item = indexable as SitecoreIndexableItem;
if (item == null)
return null;
if (item.TemplateID == TemplateIDs.ContactTemplate)
string fullName = string.Format("{0} {1}", item["Name"], item["Surname"]);
return fullName.ToString();
return null;

This example generates a ‘full name’ from the ‘name’ and ‘surname’ fields. Pretty obvious really, and there are lots of examples out there.

Next, I use a patch file to add the computed field definition into my configuration. In 7.5, this would be like:

<configuration xmlns:patch="" xmlns:set="">
<defaultLuceneIndexConfiguration type="Sitecore.ContentSearch.LuceneProvider.LuceneIndexConfiguration, Sitecore.ContentSearch.LuceneProvider">
<fields hint="raw:AddComputedIndexField">
<field fieldName="_content">Example.Indexing.FullNameComputedField, Example</field>

However, in 7.2 this didn’t work properly. Instead of adding another field to write into content, it would change/update the existing, built-in definition for _content.

In 7.2 it needs to be:

<fields hint="raw:AddComputedIndexField">
<field fieldName="_content" type="Example.Indexing.FullNameComputedField, Example" />

That’s just the central bit, but this adds another field to write, rather that overwriting it. I think this is due to the ‘type’ attribute being present, but it is definitely a difference between 7.2 and 7.5


Appending to the _content field in Sitecore Search 7.2 and 7.5

2 thoughts on “Appending to the _content field in Sitecore Search 7.2 and 7.5

Leave a Reply


You are commenting using your account. Log Out /  Change )

Google photo


Twitter picture


Facebook photo


Connecting to %s
