Copied to clipboard

Flag this post as spam?

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


  • Dima Stefantsov 100 posts 225 karma points
    May 09, 2013 @ 23:50
    Dima Stefantsov
    0

    Pagination bug

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

    Looks like postCount contains count of all posts, even not published ones. I'm trying to prepare my publishing ahead, and my first page is now empty. (while I just have 1 published record)

  • Dima Stefantsov 100 posts 225 karma points
    May 10, 2013 @ 01:53
    Dima Stefantsov
    0

    I'm actually quick-fixing it by setting big items-per-page for now while I'm waiting for a good fix.

    One of the ways I found is to set supportUnpublished="false" in Examine config. I totally don't understand what other things it might influence, I will not use this solution.

    Other good thing would be to change your code like
    private IEnumerable<DynamicNode> GetDescendentsOrSelf(
    ...
    if (child.NodeTypeAlias == targetAlias && child.SomeWayToKnowIsNodePublished) 

    But there are no such property I found. And I totally thought Nodes are some active entities that are in cache or something, and they must be published already to be there. Document type, on other hand, does have IsPublished boolean, according to manual.

    That code is depressing me. I was sure it just must be simple 10 lines of code to implement blog backend on CMS...

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    May 10, 2013 @ 11:44
    Anthony Dang
    0

    Thanks for reporting this... the issue is that i'm getting examine results using the internal index which indexes published and unpublished nodes. I thought the "ToIPublishedContent()" would fix it, but obviously put it in the wrong place.

     

Please Sign in or register to post replies

Write your reply to:

Draft