Jeremy Davis
Jeremy Davis
Sitecore, C# and web development
Article printed from: https://blog.jermdavis.dev/posts/2015/that-search-build-option

That search index rebuild option is too hard to find...

Published 06 April 2015
Updated 25 August 2016
Lucene Sitecore UI ~1 min. read

The other day a colleague remarked on how much time was wasted navigating down to the search index rebuild options in the Sitecore 6.6 Control Panel. While there are a variety of other ways of triggering a search rebuild, (Sitecore Rocks for example) it was suggested that having a button on the Ribbon (as per Sitecore 7) would be helpful in this case. So here's a quick set of instructions for one way it can be added:

The individual sections of the Ribbon are referred to as "chunks" and they are defined in the Core database by the items under /sitecore/content/Applications/Content Editor/Ribbons/Chunks:

Ribbon Chunks

You can create a new chunk for search indexing by inserting a new item based on the /sitecore/content/System/Ribbon/Chunk template and filling in its Header field with the name you want displayed in the ribbon.

Under this you can create a button from the /sitecore/templates/System/Ribbon/Large Button template. Again, fill in the Header field along with the Icon and ToolTip fields. Finally you need to add the value for the command to be triggered in the Click field. If you dig through the Start Menu data for the Control Panel (under /sitecore/content/Applications/Control Panel/Database/Rebuild search index) you will discover the item that describes the existing option:

Control Panel

So the command we need to trigger is system:rebuildsearchindex. And this can be set in your new ribbon button.

With that set, the remaining task is to add the new ribbon chunk into the definition of a ribbon so it will be visible. This is set up by adding the chunk to an existing Ribbon Strip. These are stored under /sitecore/content/Applications/Content Editor/Ribbons/Strips. Add a new item based on the /sitecore/templates/System/Reference template under your preferred strip - for example the Home strip. The new strip item has only one field – in which you select the Ribbon chunk you want displayed:

Ribbon Strip

Save that change, and if you've done it all right your new button will appear straight away. (No publishing required with the Core database) And when you click it you'll get the standard index rebuilding dialog:

New Button

You can then change back to the Master database and save yourself a few clicks each time you need to build an index...

↑ Back to top