Hi,
Can I trigger the update mechanism of the DynamicwebProductIndexer via the api.
If yes how to do this?
kind regards,
Remi
Developer forum
E-mail notifications
DynamicwebProductIndexer
Posted on 24/02/2011 16:05:40
Replies
Posted on 25/02/2011 05:05:28
Hi Remi!
You can add refference to the Dynamicweb.Searching.dll library
And then, execute Searching.Management.IndexUpdateService.Current.CreateTask(string path, bool isPartial) function to start updating.
path - is relative to /Files/System/_search path to the index folder (f.e. "Products")
isPartial - full/partial update
Best regards, Vladimir
You can add refference to the Dynamicweb.Searching.dll library
And then, execute Searching.Management.IndexUpdateService.Current.CreateTask(string path, bool isPartial) function to start updating.
path - is relative to /Files/System/_search path to the index folder (f.e. "Products")
isPartial - full/partial update
Best regards, Vladimir
Posted on 28/02/2011 08:01:48
Hello Remi,
As Vladimir pointed, the one option is to call the CreateTask method of the IndexupdateService object like the following:
using Dynamicweb.Searching.Management;
public void UpdateProductIndex(bool isFullUpdate)
{
IndexUpdateService.Current.CreateTask("Products", isFullUpdate);
}
Where "isFullUpdate" means whether any information persisted in the queue should be discarded and the index should be recreated "from scratch".
Although you need to know that calling this method doesn't necessarily means that the index will start updating right away. This is because the method simply registers new task for the background thread which will perform an actual update. So you shouldn't expect the index to become up-to-date when the method is executed. If you want to update the index "synchronously" you can use another approach:
using Dynamicweb.Searching;
public void UpdateProductIndex(bool isFullUpdate)
{
IndexManager.Current.UpdateIndex("Products", isFullUpdate);
}
This method perform an actual update. But note that it might take several minutes before it completes.
Hope this will help you.
-- Pavel
As Vladimir pointed, the one option is to call the CreateTask method of the IndexupdateService object like the following:
using Dynamicweb.Searching.Management;
public void UpdateProductIndex(bool isFullUpdate)
{
IndexUpdateService.Current.CreateTask("Products", isFullUpdate);
}
Where "isFullUpdate" means whether any information persisted in the queue should be discarded and the index should be recreated "from scratch".
Although you need to know that calling this method doesn't necessarily means that the index will start updating right away. This is because the method simply registers new task for the background thread which will perform an actual update. So you shouldn't expect the index to become up-to-date when the method is executed. If you want to update the index "synchronously" you can use another approach:
using Dynamicweb.Searching;
public void UpdateProductIndex(bool isFullUpdate)
{
IndexManager.Current.UpdateIndex("Products", isFullUpdate);
}
This method perform an actual update. But note that it might take several minutes before it completes.
Hope this will help you.
-- Pavel
Posted on 28/02/2011 09:49:57
Thanks for all the replies :)
Today i will check this out.
Today i will check this out.
You must be logged in to post in the forum