Open items from bucket search in main content tree in Sitecore

Sitecore now provides us with this very useful ways of searching for items which are organized within item buckets.
We ran into a requirement where we didn’t want multiple tabs to open as and when one clicked on a search result, and we wanted the search result item to open in the main content tree instead.
This would enable the content authors to locate items in the item tree and create subitems / manipulate them. Even though the bucket search results page does allow creation of subitems (provided insert options are set), this provides a simpler means of browsing through subitems in a more effective manner.

To be able to achieve this, we need a config update and corresponding code update.


using Sitecore;
using Sitecore.Buckets.Pipelines.UI.LaunchResultPipeline;
using Sitecore.Data;
using Sitecore.Data.Items;
using System;

namespace MySite.SitecoreProcessors
    public class LaunchSitecoreResultMainWindow : LaunchSitecoreResult
        protected override void LaunchResult(LaunchResultArgs args)
            if (!string.IsNullOrEmpty(args.IndexableId))
                ID itemId = ID.Parse(args.IndexableId);
                Item myItem = Context.Database.GetItem(itemId);

                if (myItem != null)
                    Context.ClientPage.SendMessage(this, String.Concat(
                        new object[] {"item:load(id=", myItem.ID, ",language=", myItem.Language, ",version=", myItem.Version, ")"}));

Here’s the config update:

          <processor desc="sitecore">
            <patch:attribute name="type">MySite.SitecoreProcessors.LaunchSitecoreResultMainWindow, MySite</patch:attribute>

So now, when we search for an item within a bucket, and click on a search result, it will open in the main content editor.




, , ,

  1. #1 by Lilia on October 27, 2016 - 6:26 pm

    Thanks! You saved my day!


  2. #2 by Lilia on October 27, 2016 - 6:48 pm

    I belive there should be ContentDatabase:
    Item myItem = Context.ContentDatabase.GetItem(itemId);
    If use context.Database it is core and error as a result


  3. #3 by Petko on June 20, 2017 - 1:37 am

    There is a settings for this: master:/sitecore/system/Settings/Buckets/Item Buckets Settings


Leave a Reply

Fill in your details below or click an icon to log in: Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: