I wrote a class that updates the index on publish.
using umbraco.BusinessLogic;
using umbraco.cms.businesslogic.web;
using Examine;
public class UmbracoEvents: ApplicationBase
{
/// <summary>Constructor</summary>
public UmbracoEvents()
{
Document.AfterPublish += new Document.PublishEventHandler(Document_AfterPublish);
}
private void Document_AfterPublish(Document sender, umbraco.cms.businesslogic.PublishEventArgs e)
{
// Rebuild SiteSearchIndexer
ExamineManager.Instance.IndexProviderCollection["SiteSearchIndexer"].RebuildIndex(); // Unfortunately this doesn't index the latest change
}
}
However it doesn't get the latest change even if it is supposed to
run "after" publish. So, to make the search results up to date, I have
to publish twice.
Why is that happening? I want the index to be updated when the user publish a content. Did I do anything wrong?
Document.AfterPublish and indexing
I wrote a class that updates the index on publish.
However it doesn't get the latest change even if it is supposed to run "after" publish. So, to make the search results up to date, I have to publish twice.
Why is that happening? I want the index to be updated when the user publish a content. Did I do anything wrong?
is working on a reply...