Copied to clipboard

Flag this post as spam?

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


  • Khai 71 posts 161 karma points
    Oct 04, 2013 @ 16:52
    Khai
    0

    Umbraco search with Multinode Tree Picker

    So I'm not too familiar how search works in Umbraco, but I've a website that is structured like this:

    - Home

    - Content page 1

    - Content page 2

    - Shared Content

    - Content block 1 

    - Content block 2, etc.

    So the pages are actually built out from content blocks, by selecting the content blocks with a multinode tree picker. I'm not sure how examine will deal with this, because the content pages actually only contain id's of the content blocks, and I want the search to index the content page based on the content blocks in the multinode tree picker. Does anyone have a clue how to configure the search for this?

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Oct 04, 2013 @ 17:14
    Ismail Mayat
    100

    Khai,

    You need to implemeent gatheringnode data event then for the page get the node ids set my mutli tree node picker then get the content for those nodes and inject it into the content see http://bit.ly/1bmmpQC for more information on how to implement gathering node data. Else the other option is to use http://our.umbraco.org/projects/website-utilities/full-text-search this works a bit like a crawler.

    Regards

    Ismail

  • Khai 71 posts 161 karma points
    Oct 11, 2013 @ 10:39
    Khai
    0

    Hi Ismail, I've setup full text search but it doesn't seem it crawls the nodes from the multinode tree picker.. do I have to implement the gatheringnode data on top of it?

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Oct 11, 2013 @ 11:45
    Ismail Mayat
    0

    Khai,

    The full text search should crawl the rendered page so you don't need gatheringnode data. The rendered page should contain the multitree node picker content as you render the content out on the rendered page?

    I have not used this package myself but looking at the docs that's how it works. Can you double check any config files etc for the package and if nothing evident then i would ask on the package forums.

    Regards

    Ismail

  • Alan Josephson 4 posts 24 karma points
    Jan 30, 2014 @ 23:48
    Alan Josephson
    0

    Ismail,

    Using Examine, I would like to replace the comma-separated treepicker contentids with the path names of the content nodes (e.g. NorthAmerica/UnitedStates/Texas), but I do not know how to access the ContentService to look these up. My custom indexer that derives from BaseUmbracoIndexer does not have a reference (BaseUmbracoIndexer.DataService.ContentService is not the same as the one provided through the UmbracoContext).

    Any ideas?

    Regards, Alan

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Jan 31, 2014 @ 10:05
    Ismail Mayat
    0

    Alan,

    In the past I have just done:

            void TefExamineEvents_GatheringNodeData(object sender, IndexingNodeDataEventArgs e)
        {
            if (e.IndexType == IndexTypes.Content && e.Fields["nodeTypeAlias"].ToLower()=="product")
            {
                var node = ApplicationContext.Current.Services.ContentService.GetById(e.NodeId);
    
                LogHelper.Info(typeof(ExamineEvents), () => "in gathering node data for " +
                                      Helpers.Constants.Examine.TefIndexer);
    
                InjectTags(e, node);
            }
        }
    

    So you could in a similar way use GetById but pass in the node id from the multi node tree picker field.

    Regards

    Ismail

  • Alan Josephson 4 posts 24 karma points
    Jan 31, 2014 @ 18:01
    Alan Josephson
    0

    Ismail,

    Thank you - exactly what I was looking for! I didn't realize ApplicationContext was accessible here and could provide me with a way to get to the ContentService.

    Alan

Please Sign in or register to post replies

Write your reply to:

Draft