Copied to clipboard

Flag this post as spam?

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


  • Guillaume 5 posts 26 karma points
    Aug 01, 2013 @ 18:14
    Guillaume
    0

    Issues with Listing by Tag / uBlogsy 3 MVC on Umbraco 6.1.1.

    Hi,

    First off, thanks for that nice piece of code, really useful.

    I have a slight issue...in fact 2...

    The first one was easily overcome: When using "PostService.Instance.GetPosts" to retrieve my blog posts, even if i pass 10 as "itemsPerPage", the first 2 pages contains 9 items, then the following ones 10, until the last one. I have 62 items (made sure of that querying manually the db) but postCount reports 64.... (i have no Unpublished articles).
    To fix it, i reverted to using NoLuceneFallbackService.Instance.GetPosts which render the pages & amount of items correctly.

    The second one is that while NoLuceneFallbackService.Instance.GetPosts fixed my listing problem, it broke the listing by Tag (listing by Author still works). The page still renders, but no blog posts are returned. This feature worked using PostService.Instance.GetPosts.

    Any clue on what to do to fix this ?

  • Guillaume 5 posts 26 karma points
    Aug 02, 2013 @ 15:57
    Guillaume
    0

    ------------------
    const int ITEMS_PER_PAGE = 10; // for testing 

    //for testing purpose i removed the skip, just to see how many item renders
    var posts = PostService.Instance.GetPosts(Model.Content, tag, label, author, searchTerm, commenter, year, month, day, out postCount).Take(ITEMS_PER_PAGE).ToIPublishedContent(true); 

    //simple foreach to get every node in posts
    var gcounter = 1;
    foreach(var post in posts){
    <p>@gcounter - @post.Name</p>
    gcounter++;


    --------------- 

    It outputs 1 to 9, not 10...

    postCount returns 64 (should return 62)...

    When i call PostService.Instance.GetPosts removing the "Take(var)" to return everything... posts.Count() = 62 and postCount still = 64
     

  • Guillaume 5 posts 26 karma points
    Aug 02, 2013 @ 17:44
    Guillaume
    0

    Nevermind, i deleted all Lucene indexes files, and "save & publish" each blog post and it fixed the issue. Quite tedious, but at least, now it works

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Aug 27, 2013 @ 16:13
    Anthony Dang
    0

    I think you could have also done a save & publish by right-clicking the root node.

     

  • Robin Hjelmeir 24 posts 85 karma points
    Nov 04, 2013 @ 20:41
    Robin Hjelmeir
    0

    I was having an issue with the number of posts showing up per page (on the blog landing). I was suppose to have 6 posts per page, but some of the pages had different amounts. I fixed this by changing:

    var posts = PostService.Instance.GetPosts(Model.Content, tag, label, author, searchTerm, commenter, year, month, day, out postCount).Skip((page - 1) * itemsPerPage).Take(itemsPerPage).ToIPublishedContent(true);

    to

    var posts = PostService.Instance.GetPosts(Model.Content, tag, label, author, searchTerm, commenter, year, month, day, out postCount).ToIPublishedContent(true).Skip((page - 1) * itemsPerPage).Take(itemsPerPage);

    Not the best fix, as I assume there will be a slight performance issue.

    I assume the reason for mine is I somehow had some null nodes, not sure how, but the ToIPublishedContent with option true, ignores null nodes. And I need to ignore the null nodes before selecting the Take(items)

Please Sign in or register to post replies

Write your reply to:

Draft