Fragmented sorting issue

 

Hi, I have a strange problem ocuring when I try to use OrderBy for any given propery: The ordering is fragmented.

What I mean by that is if I OrderBy on number I get something like: 1, 2, 5, 6, 3, 4, 7, 8, 0 and then 6, 5, 2, 1, 8, 7, 4, 3, 0 for descending. It seams like the result is getting orderd by something else before ordering on the number, but I have triple-checked the request and there is only one sort object in the sort array.

query.OrderBy(arg => arg.Code);

Gives: 

    [0]: "22565423125"
    [1]: "22565423216"
    [2]: "22565423236"
    [3]: "22565423294"
    [4]: "22565423130"
    [5]: "22565423140"
    [6]: "22565423291"
    [7]: "22565423297"
    [8]: "22565423614"
    [9]: "22565423622"
    [10]: "22565423627"
    [11]: "22565423647"
    [12]: "22565423231"
    [13]: "22565423285"
    [14]: "22565423637"
    [15]: "22565423642"
    [16]: "22565423120"
    [17]: "22565423221"
    [18]: "22565423226"
    [19]: "22565423288"
    [20]: "22565423300"
    [21]: "22565423135"
    [22]: "22565423211"
    [23]: "22565423652"

And 

query.OrderByDescending(arg => arg.Code);

Gives: 

    [0]: "22565423236"
    [1]: "22565423216"
    [2]: "22565423125"
    [3]: "22565423115"
    [4]: "22565423647"
    [5]: "22565423627"
    [6]: "22565423622"
    [7]: "22565423614"
    [8]: "22565423297"
    [9]: "22565423291"
    [10]: "22565423140"
    [11]: "22565423130"
    [12]: "22565423642"
    [13]: "22565423637"
    [14]: "22565423285"
    [15]: "22565423231"
    [16]: "22565423300"
    [17]: "22565423288"
    [18]: "22565423226"
    [19]: "22565423221"
    [20]: "22565423120"
    [21]: "22565423652"
    [22]: "22565423632"
    [23]: "22565423135"

I have tried switching indexes and still the issue remains.

I'm using Episerver.Find 13.0.1.

#191962 May 03, 2018 11:17
  • Mari Jørgensen
    Member since: 2003
     

    I would think that is because Code field is of type string - assuming you are talking about Code property on a catalog item.

    #191983 Edited, May 03, 2018 12:20
  •  

    That should still work, right?

    But regardless, I have tried with decimal and int with the same result.

    #192003 May 03, 2018 13:09
  •  

    I tried to OrderBy date and that seems to work. 

    With decmial I get:

    query.OrderBy(arg => arg.ListPrice());
        [0]: 169.99
        [1]: 349.95
        [2]: 398.65
        [3]: 424.92
        [4]: 509.15
        [5]: 594.15
        [6]: 644.3
        [7]: 696.15
        [8]: 823.65
        [9]: 1184.97
        [10]: 2899.99
        [11]: 143.4
        [12]: 220.15
        [13]: 229.46
        [14]: 237.15
        [15]: 277.1
        [16]: 299.99
        [17]: 313.65
        [18]: 325.51
        [19]: 499.99
        [20]: 509.15
        [21]: 526.15
        [22]: 577.15
        [23]: 1104.15
    #192009 May 03, 2018 13:29
  • Mari Jørgensen
    Member since: 2003
     

    Got curious - did a test using Find v. 12.5.3 ( see results below). So you are right, should still work. Would file it as a bug in v. 13.0.1

    By code:
    10003556
    10004299
    10109080
    10114122
    10156933
    10156958
    10156966
    10156974
    10156982
    10157113
    10168110
    10168128
    10168136
    10168151
    10168177
    10168193
    10168268
    10168276
    10168284
    10168292

    #192018 May 03, 2018 15:08
  •  

    I down graded to Find v. 12.7.1 and it works.

    Have now reported it to support.episerver.com

    #192026 May 03, 2018 16:47
  •  

    Update: I uppgraded to Episerver.Commerce 12 and now the Ordering works... though I don't know why this effected ordering for Find.

    #192053 May 04, 2018 10:20
  • Mari Jørgensen
    Member since: 2003
     

    @Jakob: So ordering works with Commerce 12 and Episerver.Find 13.0.1?

    #192055 May 04, 2018 10:38
  •  

    Yes. It did upgrade EPiServer.Find.Commerce from v. 10.2.0 to v. 11.0.0 as well.

    #192056 May 04, 2018 10:40
  • Grzegorz Jeremias
    Member since: 2012
     

    Hi,

    Jakob did you get any answer to that from support?
    It seems we have just hit into same issues with searching. For us searching by date does not work as well. Originally I thought it is just DateTime type but then realized that sorting also by other string properties added to page types does not work at all when running Find 13 (or it makes sorting somehow fragmented just like you described).
    Sorting WORKS on default fields like StartPublish or Name.
    I have confirmed that also trying on Alloy site.

    After downgrading to version 12.7.1 it is working again, is there any bug registered by support already? and when we could expect fixing?

    Br, Greg

    #192233 May 11, 2018 14:06
  •  

    Hi Grzegorz,

    I got it to work by upgrading Episerver.Commerce to 12 and Episerver marked my ticket as solved.

    I don't think they should have done that as the reason for the issue is still unknown, but as it started working for me I didn't continue with the ticket.

    #192235 May 11, 2018 14:39
  • Grzegorz Jeremias
    Member since: 2012
     

    Well we do not run Commerce and similar issue is there, I created ticket for that as well

    #192236 May 11, 2018 14:42
  •  

    Great! Come back with any updates as I'm (and maybe others) still interested in why this happens.

    #192237 May 11, 2018 14:47
  • dada
    Member since: 2012
     

    We're investigating this again.

    When reproducing this we also see that it is working when downgrading from 13.01 to 12.7.1 but we also notice that it continues to work after upgrading back to 13.0.1. 

    We're trying to figure out why this is.

    Thanks

    Daniel Dahlin, Developer Support

    #192334 Edited, May 15, 2018 13:48
  • dada
    Member since: 2012
     

    This has been confirmed to be a bug in Find 13.01. Bug FIND-3596. 

    When testing locally this seems to be a possible workaround

     .OrderBy(arg => arg.Code, null, null, false);    



    #192566 May 18, 2018 15:08
  • Grzegorz Jeremias
    Member since: 2012
     

    Hi
    Fresh info about bug from support (thanks Daniel)

    Hi Grzegorz,
    
    This bug is fixed. When it's due for release it should appear here.
    https://world.episerver.com/support/Bug-list/bug/FIND-3596
    #193957 Jun 08, 2018 13:32
  • Michael Clausing
    Member since: 2016
     

    Just wanted to bump this, as we have seen issues with orderby as well. We were able to get around the issue using the solution posted by dada.

    #195469 Jul 25, 2018 17:04
  • Son Do
    Member since: 2012
     

    Sorry for late comment. I also created a late blog post for this issue https://world.episerver.com/blogs/Son-Do/Dates/2018/7/sorting-issue-in-episerver-find-13-0-1/.

    This issue will be released pretty soon after Find service is upgraded.

    Regards,

    /Son Do

    #195494 Jul 26, 2018 15:23