Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Aximili 177 posts 278 karma points
    Jun 14, 2011 @ 05:15
    Aximili
    1

    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?

     

  • Jon Boyer 37 posts 59 karma points
    Jan 24, 2012 @ 22:14
    Jon Boyer
    1

    Was there ever a solution to this?

  • Aximili 177 posts 278 karma points
    Jan 24, 2012 @ 23:30
    Aximili
    1

    Hi Jon,

    This is what I ended up doing

    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();
    }
  • Jon Boyer 37 posts 59 karma points
    Jan 24, 2012 @ 23:47
    Jon Boyer
    1

    Thanks Hardi!

     

    Um...this is going to sound stupid.  Which file does that code actually go in?

     

     

     

     

  • Aximili 177 posts 278 karma points
    Jan 25, 2012 @ 01:46
    Aximili
    1

    You can create a new class like this :)

    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();
    }
    }
  • Jon Boyer 37 posts 59 karma points
    Jan 31, 2012 @ 22:02
    Jon Boyer
    0

    That appears to have worked nicely.

     

    Thank you!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies