Jeremy Davis
Jeremy Davis
Sitecore, C# and web development
Article printed from: https://blog.jermdavis.dev/posts/2017/buckets-are-more-important-than-you-thought

Buckets are more important than you thought...

Published 20 March 2017
Updated 26 June 2018

Every so often you come across a small config change which does stuff you just did not expect. I hit an issue around this recently, which I figured I should document to try and prevent anyone else getting to spend time with diff, scratching their head for as long as I did...

The core problem: url copied!

Grab yourself an instance of Sitecore. I've done this with v8.2 and v8.0, but versions back to v7.2 will show the same behaviour.

Then make one config edit. Open up Sitecore.Buckets.config in your preferred text editor and find the bit towards the end of the file where settings are configured. Then change the setting BucketConfiguration.ItemBucketsEnabled to false:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <!-- snip -->

    <settings>
      <!-- ITEM BUCKETS ENABLED
           This setting specifies whether or not the Item Buckets feature is enabled.
           Default value: true
      -->
      <setting name="BucketConfiguration.ItemBucketsEnabled" value="false"/>

      <!-- snip -->
    </settings>
  </sitecore>
</configuration>

					

Shouldn't do much, right? You'd expect the features for Item Buckets to go away, but not much more?

Well, you'd be wrong.

Go check out your control panel. Notice anything odd?

Indexing Manager

Yup – the entire Indexing section has disappeared...

If you revert your change to the Buckets config then Indexing Manager will reappear.

I had some other problems too... url copied!

The first site I noticed this issue on was a development site configured for a particular client's needs. It had a collection of other odd issues that appeared when the Buckets change was applied. Since this site was more heavily customised I doubt all these errors will apply directly to other sites, but I'll document them anyway, just in case it helps anyone...

This instance was based on:

  • Sitecore 8.0 rev 150812
  • Coveo for Sitecore 3.0.1123 (locally installed)

The first issue I noticed was that lots of code which made use of ContentSearch APIs stopped working correctly – and threw errors about missing indexes:

4652 12:17:28 ERROR There is no appropriate index for /sitecore/social/Messages - {DBB82699-FEE0-4A1E-9B52-FACC436925C6}. You have to add an index crawler that will cover this item
4652 12:17:28 ERROR Sitecore.Social: Social messages index could not be determined for master database. Messages root path: /sitecore/social/Messages. Please check indexes configuration.
Exception: System.ArgumentException
Message: Index  was not found
Source: Sitecore.ContentSearch
   at Sitecore.ContentSearch.ContentSearchManager.GetIndex(String name)
   at Sitecore.Social.Search.SearchProvider.GetSearchIndex()

					

and

ManagedPoolThread #7 12:23:37 ERROR Error executing command item: Rebuild Suggested Tests Index
Exception: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Sitecore.Reflection.ReflectionUtil.InvokeMethod(MethodInfo method, Object[] parameters, Object obj)
   at Sitecore.Tasks.CommandItem.Execute(Item[] items, ScheduleItem schedule)

Nested Exception

Exception: System.ArgumentException
Message: Index sitecore_suggested_test_index was not found
Source: Sitecore.ContentSearch
   at Sitecore.ContentSearch.ContentSearchManager.GetIndex(String name)
   at Sitecore.ContentTesting.Tasks.RebuildIndex.Process(Item[] items, CommandItem command, ScheduleItem schedule)

					

and if I deploy a quick hacky .aspx file that tries to query Coveo, I get:

Exception: System.ArgumentException
Message: Index Coveo_master_index was not found
Source: Sitecore.ContentSearch
   at Sitecore.ContentSearch.ContentSearchManager.GetIndex(String name)
   at ASP.experiment_aspx.searchQuery(String rootPath, String indexName)
   at ASP.experiment_aspx.__Renderform1(HtmlTextWriter __w, Control parameterContainer)
   at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
   at System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer)
   at System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer)
   at Sitecore.Web.FormAdapter.Render(HtmlTextWriter writer)
   at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
   at System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer)
   at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
   at System.Web.UI.Page.Render(HtmlTextWriter writer)
   at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

					

This confused me somewhat, as if I looked at ShowConfig.aspx, all the index configurations were still present:

Indexes

But, as suggested above, reverting the single config change to re-enable buckets got rid of all these errors.
Clearly that config setting does more than just disable the code for Buckets...

And support says... url copied!

I raised the issue with Sitecore's support team, and after a bit of thinking they pointed out this is actually covered by the release notes for v7.2 Update 1:
New features
It is now possible to disable all item buckets and Sitecore.ContentSearch functionality using the new BucketConfiguration.ItemBucketsEnabled setting in the Sitecore.Buckets.config file. (398925)
  • When this functionality is disabled, Search tabs do not appear in the Content Editor or in dialogs, all item bucket commands are hidden in the UI, the Indexing Manager is not available in the Control Panel application, and the BucketManager API ignores calls. In addition, all background processes related to indexing are disabled. (398925, 403858, 400821, 399186, 403852 )

The wording there gets to the root of the problem I think. While the config item is described as ItemBucketsEnabled the underlying behaviour is disabling a collection of important things, including aspects of the ContentSearch APIs, and hiding the Index Manager because the APIs it depends on no longer work.

That would suggest an explanation for the second set of problems I saw – Without the full suite of ContentSearch APIs enabled, code which depends on them (other search providers would be a great example) is not going to work correctly.

Conclusion... url copied!

I have two, conclusions from this:

First, that config setting is badly named. It doesn't disable Buckets – as the release notes point out, it disables ContentSearch. Now I can understand why changing the name of the setting would be a breaking change to be avoided. So I doubt that will get adjusted. But I have suggested to Support that the comment above this setting should be changed to explain the full scope of what is disabled when you change it. Fingers crossed, that will get updated in a future release. (The request is support ID 480599 if you want to poke Support about it too)

But I think the key conclusion here is "You probably don't want to turn this setting off!". Thinking back over all the dev work I've done since v7.2 was released, I can't think of a site which would have worked OK with all these things disabled. Search is used so often these days, that disabling it is only going to be safe on the simplest of websites – sites which I very much doubt get published in Sitecore...

↑ Back to top