Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-15164

Wrong sorting when using sort_by parameter

    XMLWordPrintable

Details

    Description

      It seems that when using sort_by parameter in ezfind fetch the sorting isn't right when the string contains some characters, for example spaces and/or dashes .

      Also if the name contains ä/ö etc. characters they get sorted incorrectly (ä will get sorted first).

      Steps to reproduce

      In default ezwebin - installation, create a few Product - class objects under for example Products/Software - node.
      Use for example the following names for the products (or something similar)
      aaaaaa
      aa-bb
      aa-cc
      ba-ab
      bbbbb
      ccccccccc
      ffffffffffffffff
      ff gg
      gaga
      gg ff
      gggggg
      OS Type I
      Test-Product

      Now if you use the following ezfind fetch:

      {def $srch=fetch('ezfind', 'search', hash(
                 'query', '',
                 'limit', 20,
                 'subtree_array', array(70),
                 'class_id', 'product',
                 'sort_by', hash('product/name', 'asc')
                 ))}
      
      {foreach $srch.SearchResult as $s}
         {$s.name}<br />
      {/foreach}
      

      70 is the node id for products/software in default ezwebin install.
      What you end up with is a list of products which are certainly not ordered correctly.. What I get is this:
      aaaaaa
      ba-ab
      aa-bb
      bbbbb
      aa-cc
      ccccccccc
      ffffffffffffffff
      gaga
      ff gg
      gg ff
      gggggg
      Test-Product
      OS Type I

      What you will get may vary.. It seems there's absolutely no logic to the sorting. Sometimes names with dashes and or whitespaces get ordered correctly and sometimes the get ordered according to the string after the dash or whitespace..

      Attachments

        Activity

          People

            unknown unknown
            tuomo tuomo
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: