Copied to clipboard

Flag this post as spam?

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


  • Simon Dingley 1431 posts 3332 karma points c-trib
    Oct 08, 2012 @ 18:10
    Simon Dingley
    1

    Umbraco Examine GatheringNodeData Event Never Fires

    I am subscribing to the GatheringNodeData event, I can confirm that the event subscription is successful when the application starts up yet my handler is never called - anyone else had this in 4.9.0?

      public class EventHandlers : ApplicationStartupHandler
      {
        public EventHandlers()
        {
          var searchIndexer = ExamineManager.Instance.IndexProviderCollection["SiteSearchSearcher"];
          searchIndexer.GatheringNodeData += this.SearchIndexerGatheringNodeData;
        }
    
        private void SearchIndexerGatheringNodeData(object sender, IndexingNodeDataEventArgs e)
        {
          if (e.IndexType == IndexTypes.Content)
          {
            // Extract root node ID from path:
            try
            {
              string rootNodeId = e.Fields["path"].Split(',')[1];
              e.Fields.Add("siteId", rootNodeId);
            }
            catch (Exception ex)
            {
              Log.Add(LogTypes.Error, -1, string.Concat("Failed to add rootNodeId to index: ", ex));
            }
          }
        }
  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Oct 08, 2012 @ 18:31
    Dirk De Grave
    1

    Aha, you need your indexer instead of searcher, so should be

    var searchIndexer =ExamineManager.Instance.IndexProviderCollection["SiteSearchIndexer"];
         

    Cheers,

    /Dirk

     

     

  • Simon Dingley 1431 posts 3332 karma points c-trib
    Oct 08, 2012 @ 18:39
    Simon Dingley
    0

    Well spotted! Thanks mate, 12 hours in front of my computer is obviously not helping my productivity now and still got more to do this evening :(

  • 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