Copied to clipboard

Flag this post as spam?

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


  • Johannes Lantz 156 posts 839 karma points c-trib
    Sep 30, 2021 @ 17:22
    Johannes Lantz
    0

    Skip(0) ISearchResults

    Hi!

    I am running Umbraco v 8.13. And I am trying to do a Examine search. And when I use Skip/Take to get the paged results. But when I use .Skip(0) it skips 1. I would get a total items count of 8 but I only get 7 "loopable" items. I am really struggling to see why this is happening.. When I remove the .Skip() I get a total items count of 8 and 8 "loopable" items.

    I have tried upgrading the Examine package from 1.1.0 to 1.2.2. But this still occurs.

    Any ideas why this is happening?

    //Johannes

  • Rob 3 posts 72 karma points
    Oct 05, 2021 @ 13:45
    Rob
    0

    Hi Johannes,

    I'm also experiencing this exact same issue. I'm running Umbraco version 8.15.2 and Examine v1.2.0. I spotted this when I realised what should easily have been the top search result wasn't being returned in my results at all. After spending hours looking at my filter I realised that when I removed the .skip() the result would show up as the top result.

    Rob

  • Johannes Lantz 156 posts 839 karma points c-trib
    Oct 10, 2021 @ 13:05
    Johannes Lantz
    101

    Hi Rob!

    Yea, I also noticed that. I ended up doing something like this:

        // ¯\_(ツ)_/¯
        return pageNumber == 1 ? allResults.Take(pageSize) : allResults.Skip((pageNumber - 1) * pageSize -1).Take(pageSize);
    

    It feels like a really janky solution. But it seems to do the tick..

    //Johannes

Please Sign in or register to post replies

Write your reply to:

Draft