Copied to clipboard

Flag this post as spam?

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


  • Amir Khan 1282 posts 2739 karma points
    Apr 22, 2015 @ 23:01
    Amir Khan
    0

    TagService seems expensive

    Hi,

    I'm using the following to grab tagged articles. It seems straightforward, but its taking like 20 seconds to grab 20 articles on a dev server with no traffic. Am I approaching using tagged service wrong?

    Thanks!
    Amir

    @using umbraco.cms.businesslogic.Tags
    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage

    @{
    string tag = Request.QueryString["tag"];
    var service = UmbracoContext.Application.Services.TagService;
    }

    @{
    var taggedList = service.GetTaggedContentByTag(@tag);
    foreach(var tagged in taggedList.Take(20)) {
    <p>@Umbraco.Content(@tagged.EntityId).Name</p>
    }
    }
  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    Apr 23, 2015 @ 08:47
    Dave Woestenborghs
    0

    I think the tag service works directly on the database. Than can explain the performance hit.

    Dave

  • Amir Khan 1282 posts 2739 karma points
    Apr 23, 2015 @ 20:26
    Amir Khan
    0

    Hi Dave, is there a better way to get tags with the new tag service? It seems like this method makes simple things like orderby complicated as well.

    Thanks,
    Amir

  • Amir Khan 1282 posts 2739 karma points
    Apr 23, 2015 @ 22:19
    Amir Khan
    0

    This works much better: Umbraco.TagQuery.GetContentByTag(@tag)

Please Sign in or register to post replies

Write your reply to:

Draft