Sitecore investigation: Errors installing a content package with item buckets
A colleague showed me this error today in the Sitecore log:
ERROR There is no appropriate index for [item path - {GUID}]. You have to add an index crawler that will cover this item
'I've never seen that!' was my first reaction...
This issue occurred when a Sitecore zip package with content items was installed on another environment. There were quite some lines in the Sitecore log which mentioned the same error but for different item paths and GUIDS. I looked up the GUIDS on my local machine and they were all Bucket
folder items with no content items in them.
Here's an example of how that looks like (when you've checked the Buckets option in the View toolbar):
Cause
Apparently when bucketable items are deleted their automatically generated parent folders are not deleted. There is a built-in task that periodically removes the empty Bucket
items but this is disabled by default in the configuration as Raúl Jiménez describes in this post.
Solution
When you use item buckets, make sure you uncomment the RemoveEmptyBucketFolders
agent section in the Sitecore.Buckets.config as shown below (or even better: make a patch file to enable it):
Sitecore.Buckets.config.xml
<!-- EMPTY BUCKET CLEANING JOB
This job runs at the set interval time and removes item bucket folders that no longer contain any items.
This could be cause by deleting an item from a bucket, which has no other items in it.
-->
<scheduling>
<frequency>00:00:05</frequency>
<!-- Adjust the interval and frequency as needed to speed things up on a local dev environment. -->
<agent type="Sitecore.Buckets.Tasks.RemoveEmptyBucketFolders" method="Run" interval="00:00:10">
<DatabaseName>master</DatabaseName>
</agent>
</scheduling>
Finally, always double check if there are empty Bucket
folder items before making a content package that will contain bucketable items.
Case closed