Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I rebuild a custom Lucene index on a Sitecore content delivery server?

The custom Lucene index on my Sitecore 6.2 Content Delivery server seems to be not right. So I think I need to rebuild all 3 of my custom indexes. How do I do that? Do I just have to use the shared source Index Viewer module? Right now I have that installed on my CD server, however for some reason it is not working. When I select my custom index in Index Viewer - nothing happens. So I can't rebuild the index that way. Can I just delete the index files from the hard drive? If so, how quickly will Lucene rebuild them?

like image 221
Corey Burnett Avatar asked Sep 30 '13 18:09

Corey Burnett


People also ask

What happens when index is rebuild?

Performing an index rebuild eliminates fragmentation, compacts the pages based on the existing fill factor setting to reclaim storage space, and also reorders the index rows into contiguous pages.


2 Answers

I ended up contacting Sitecore support and they pointed me to the shared source module called Sitecore Support Toolbox - http://marketplace.sitecore.net/en/Modules/Sitecore_Support_Toolbox.aspx. Once I installed that I was able to easily rebuild my indexes.

like image 82
Corey Burnett Avatar answered Sep 28 '22 09:09

Corey Burnett


Since Sitecore 6.6 update 3 or 4 (don't remember which one was it) you can rebuild your custom indexes from the Sitecore Control Panel.

In all previous versions you need to rebuild it from code or using custom modules for Sitecore. Deleting index files won't work.

The simplest code for rebuilding custom Sitecore Lucene Index is:

Sitecore.Search.SearchManager.GetIndex("your_index_name").Rebuild()

The blog post "Troubleshooting Sitecore Lucene search and indexing" can help you if rebuilding the index won't solve your problem.

like image 36
Marek Musielak Avatar answered Sep 28 '22 09:09

Marek Musielak