We have to rebuild Lucene index on our CD server.
Is there any Sitecore API to rebuild Lucene index? or rebuild a portion of tree items?
You should have a look at the documentation form Sitecore:
You can rebuild indexes from custom code by using this:
// To rebuild "new" search indexes, use this piece of code for every "new" index IndexCustodian.FullRebuild(ContentSearchManager.GetIndex("[INDEX NAME]"), true);
To rebuild all indexes:
// Or to rebuild all indexes, use the following piece of code: IndexCustodian.RebuildAll();
If you would like to index a single item:
IndexCustodian.Refresh(ContentSearchManager.GetIndex("[INDEX NAME]"), itemToRefresh);
If you need to index a tree:
SitecoreIndexableItem indexableFolder = new SitecoreIndexableItem(item); IndexCustodian.RefreshTree(indexableFolder);