Copied to clipboard

Flag this post as spam?

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


  • Ric Carey 50 posts 93 karma points
    Aug 26, 2014 @ 14:58
    Ric Carey
    0

    Quickest (Processing) way of getting a Node v6 in a Big site

    Hi just wondering what the questest way in terms of querying a website with a lot of nodes would be?

    You could do eg: Umbraco.TypedContentAtRoot().DescendantsOrSelf("docTypeAlias").FirstOrDefault();

    but in a website with a lot of nodes, and say for example sake, multiple websites in. you only want one specific node which you know would live inside something else. would it be quicker to the first one? or check at each level eg:

    var home = Umbraco.TypedContentAtRoot().Where(x = x.DocumentTypeAlias() == "Home").FirstOrDefault();

    if(home != null)

    {

    var firstLevel = home.DescendantsOrSelf("firstLevel ").FirstOrDefault();

                     if(home != null)

                     {

                     var node = home.DescendantsOrSelf("docTypeAlias").FirstOrDefault();

                     }

    }

    My thinking is that the multi level approach would mean it had less to loop over as as soon as it hits the first level it finds what it needs instead of carrying on?

    Or would there be a quicker way? using maybee examine or xpath?

     

     

  • Charles Afford 1163 posts 1709 karma points
    Aug 26, 2014 @ 21:10
    Charles Afford
    0

    Use examine. You don't want to use linq its really slow.

    http://umbraco.com/follow-us/blog-archive/2011/9/16/examining-examine.aspx

    Do all the indexing on app start and then just query your indexes.

    Charlie :)

Please Sign in or register to post replies

Write your reply to:

Draft