Copied to clipboard

Flag this post as spam?

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


  • Martin Griffiths 826 posts 1269 karma points c-trib
    Nov 18, 2016 @ 10:37
    Martin Griffiths
    0

    A common umbraco design pattern and examine

    We are following a common design pattern in Umbraco whereby we have a section (document types / nodes) defined to provide re-useable content which is embedded in a given page as required. Stuff like accordions, additional marketing info. the usual stuff you often see in side panels.

    My question is, is it possible to add these extra nodes to the examine index as if they are part of the main page. So that when someone does a site search, the returned results includes the data from the other nodes, but is considered part of the main page result?

    I hope that makes sense!

    Martin

  • Casper 70 posts 308 karma points
    Nov 18, 2016 @ 12:03
    Casper
    100

    Hi,

    You can add whatever fields you need to the indexset you are using, and then populate them by hooking up to the GatheringNodeData event of your index provider:

    using Examine;
    using Umbraco.Core;
    
    namespace App
    {
        public class ExamineHandler : IApplicationEventHandler
        {
    
            const string INDEX_PROVIDER = "ExternalIndexer";
    
            public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
            {
    
                ExamineManager.Instance.IndexProviderCollection[INDEX_PROVIDER].GatheringNodeData += (sender, e) =>
                {
                    // get data from other content...
    
                    // add field key and data
                    e.Fields.Add("KEY", "VALUE");
    
                };
            }
    
            public void OnApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
            {
            }
    
            public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
            {
            }
        }
    
    }
    
  • Barry Fogarty 493 posts 1129 karma points
    Nov 18, 2016 @ 12:07
    Barry Fogarty
    0

    What you need is a way for Examine to cache the html output of your web pages. Shannon from Umbraco HQ discussed this on his blog some time ago, but I'm not sure if anything came of it. He laid out the concepts here.

Please Sign in or register to post replies

Write your reply to:

Draft