When I edit a page and publish it, the examine index is not updated, hence search results are always out of date.
I have searched this forum and tried editing ExamineSettings.config, removing analyzer and setting runAsync to false. It didn't help.
I found some people posted the code to update the index, but that's not the solution I am after. Shouldn't the index be updated automatically everytime you update the content?
umbraco.content.AfterUpdateDocumentCache += new umbraco.content.DocumentCacheEventHandler(content_AfterUpdateDocumentCache);
...
private void content_AfterUpdateDocumentCache(Document sender, umbraco.cms.businesslogic.DocumentCacheEventArgs e) { // Rebuild SiteSearchIndexer (Search results will be updated after a few minutes) ExamineManager.Instance.IndexProviderCollection["SiteSearchIndexer"].RebuildIndex(); }
using System; using umbraco.BusinessLogic; using umbraco.cms.businesslogic.web; using Examine; using System.Text.RegularExpressions; using System.Web; using umbraco.controls;
public class UmbracoEvents: ApplicationBase { /// <summary>Constructor</summary> public UmbracoEvents() { umbraco.content.AfterUpdateDocumentCache += new umbraco.content.DocumentCacheEventHandler(content_AfterUpdateDocumentCache); }
privatevoid content_AfterUpdateDocumentCache(Document sender, umbraco.cms.businesslogic.DocumentCacheEventArgs e) { // Rebuild SiteSearchIndexer (Search results will be updated after a few minutes) ExamineManager.Instance.IndexProviderCollection["SiteSearchIndexer"].RebuildIndex(); } }
Examine Index is not updated automatically
When I edit a page and publish it, the examine index is not updated, hence search results are always out of date.
I have searched this forum and tried editing ExamineSettings.config, removing analyzer and setting runAsync to false. It didn't help.
I found some people posted the code to update the index, but that's not the solution I am after. Shouldn't the index be updated automatically everytime you update the content?
Was there ever a solution to this?
Hi Jon,
This is what I ended up doing
Thanks Hardi!
Um...this is going to sound stupid. Which file does that code actually go in?
You can create a new class like this :)
That appears to have worked nicely.
Thank you!
is working on a reply...