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?
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?
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 :)
is working on a reply...