Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-102817

Service Builder finder results are not sorted consistently

    Details

      Description

      Service Builder finder results are not consistent:

      • in case you don't specify pagination parameters sort is done in java side
      • in case you specify pagination parameters sort is done in database side

      But sorting data in java side doesn't returns same results than database side:

      • Database sort (MySQL or Postgresql) ignores accents (áááá = aaaa in sort time)
      • Java sort doesn't ignore accents (áááá != aaaa in sort time)

      Sorting large amount of data in java side, can also cause some throughput issues. It is better to rely in database side sorting as it is optimized doing that tasks.

      Steps to reproduce (Wiki)

      1. Create WikiPages with following names: ááá, aaaa, AAAAA, ÁÁÁÁÁÁ, BBBBBB
      2. Query database using the finder with start = -1 and end = -1   (sort is done by ServiceBuilder code)
        for (def wikiPage : com.liferay.wiki.service.WikiPageLocalServiceUtil.getWikiPages(-1,-1)) {
            out.println(wikiPage.getTitle());
        }
      3. Query database using the finder with start = 0 and end = 50   (sort is done in Database)
        for (def wikiPage : com.liferay.wiki.service.WikiPageLocalServiceUtil.getWikiPages(0,50)) {
            out.println(wikiPage.getTitle());
        }
      4. Compare results:
        • Expected behavior: both queries returns wikipages in same order
        • Wrong behavior: queries returns wikipages in diferent order

      Steps to reproduce (Organizations)

      1. Create Organizations with following names: ááá, aaaa, AAAAA, ÁÁÁÁÁÁ, BBBBBB
      2. Query database using the finder with start = -1 and end = -1 (sort is done by ServiceBuilder code)
        for (def organization : com.liferay.portal.kernel.service.OrganizationLocalServiceUtil.getOrganizations(-1,-1)) {
            out.println(organization.getName());
        }
      3. Query database using the finder with start = 0 and end = 50 (sort is done in Database)
        for (def organization : com.liferay.portal.kernel.service.OrganizationLocalServiceUtil.getOrganizations(0,50)) {
            out.println(organization.getName());
        }
      4. Compare results:
        • Expected behavior: both queries returns Organizations in same order
        • Wrong behavior: queries returns Organizations in diferent order

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                summer.zhang Summer Zhang
                Reporter:
                jorge.diaz Jorge Diaz
                Participants of an Issue:
                Recent user:
                Clarissa Velazquez
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  8 weeks, 5 days ago

                  Packages

                  Version Package
                  7.0.0 DXP FP87
                  7.0.10.12 DXP SP12
                  7.0.X
                  7.1.10 DXP FP15
                  7.1.X
                  7.2.10 DXP FP3
                  7.2.X
                  7.2.1 CE GA2
                  Master