Developer forum

Forum » Development » Rebuild new index for repositories programmatically

Rebuild new index for repositories programmatically

Kasper Vesth
Reply

Hello

We have updated our site to use the new repositories for our search index and filters. We have a custom import running, and in the end of that we want to rebuild the search index.

For the "old" index we could do this:

IndexManager.Current.UpdateIndex(new ProductIndexer(), true);

If I wanted to do the same with the new index, how would I go about it?

Regards

Kasper


Replies

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi Kasper,

Take a look at this post: http://developer.dynamicweb.com/forum/development/new-indexing-documentation.aspx#Reply41898

- Jeppe

 
Kasper Vesth
Reply

Thank you Jeppe :) I did not expect it to be in a post with that subject.

So if I have multiple instances I would need to run the rebuild function for each in turn and check whether they succeeded?

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

For the moment, yes. You can use a helper method called IsInstanceAvailable on the IndexHelper class to know whether the instance has been built successfully. If you want more detailed information, like if it's currently building or why it failed, you need to use the TaskManager to get the status of the build task. The name of the task to query would be "<repository>#<index>#<instance>".

- Jeppe

 

You must be logged in to post in the forum