Posted on 30/07/2024 10:39:06
Hi Josheph,
You can subscribe to the Application.AfterStart notification and then call Dynamicweb.Indexing.IndexHelper.BuildIndexInstances().
Assuming they are small and only take a few seconds each, you should be fine. If you have large indexes that take multiple minutes to complete, you may see this taking even longer. We've experienced that concurrent builds take longer to complete than if they were triggered in sequence (one at a time).
Here's a quick example on how to subscribe to it
using Dynamicweb.Extensibility.Notifications;
namespace MyNamespace
{
[Subscribe(Dynamicweb.Notifications.Standard.Application.AfterStart)]
public class ApplicationStart : NotificationSubscriber
{
public override void OnNotify(string notification, NotificationArgs args)
{
if (!(args is Dynamicweb.Notifications.Standard.Application.AfterStartArgs myArgs))
{
return;
}
// your code here
}
}
}
Best Regards,
Nuno Aguiar