November Happy Hour will be moved to Thursday December 5th.

Code to Invoke Rebuild of Serach Index

Vote:
 

HI

Can anyone point me to the code which rebuilds the commerce catalog search index. I am basically using the Catalog DTO to add data - but want to reindex the catalog once it is done. I am aware that the Quartz service does incremental updates to the index , but I would like to rebuild the full index in my code itself.

Would also be helpful to know how to configure the quartz service to do full rebuild of index at a specific time.

Your input is much appreciated.

Kind Regards

Sandeep

 

#59336
Jun 01, 2012 13:36
Vote:
 

Hi Sandeep

Reflection is your friend, the IndexTab user control contains the various buttons and code to invoke the index rebuild.

Below are some methods extracted from the user control code behind

protected void ProcessRebuildButtonEvent(bool rebuild)
{
    this._SearchManager = new SearchManager(AppContext.Current.ApplicationName);
    if (rebuild)
    {
        this.ProgressControl1.StartOperation(new ThreadStart(this.StartIndexRebuild));
        return;
    }
    this.ProgressControl1.StartOperation(new ThreadStart(this.StartIndexIncrementalBuild));
}

private void StartIndexRebuild()
{
    try
    {
        string arg_05_0 = string.Empty;
        this._SearchManager.SearchIndexMessage += new SearchIndexHandler(this._SearchManager_SearchIndexMessage);
        this._SearchManager.BuildIndex(true);
    }
    catch (Exception ex)
    {
        this.ProgressControl1.AddProgressMessageText(ex.Message, true, -1);
    }
}



So basically you need to:

1. Create a new instance of the MediaChase.Search.SearchManager
2. Call BuildIndex telling it to rebuild.

:)


Lee

 

 

#59341
Jun 01, 2012 15:17
Vote:
 
#59342
Jun 01, 2012 15:33
Vote:
 

Thanks

 

Kind Regards

Sandeep

#59343
Jun 01, 2012 15:36
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.