Uploaded image for project: 'Hippo Site Toolkit 2'
  1. Hippo Site Toolkit 2
  2. HSTTWO-3829

Support orderBy[CaseInsensitive](order, fieldNames) in fluent query api

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.1.0
    • Component/s: None
    • Labels:
      None
    • Similar issues:
    • Sprint:
      Platform Sprint 140
    • Processed by team:
      Platform

      Description

      Currently, you'd be required to write the following code:

      if (sortBy != null && !sortBy.isEmpty()) {
                      if (sortOrder == null || sortOrder.isEmpty() || "descending".equals(sortOrder)) {
                         HstQueryBuilder.create(scope)
                            .ofTypes(docType)
                            .orderByDescending(sortBy)
                            .limit(pageSize)
                            .offset(pageSize * (crPage - 1))
                            .build(); 
                      } else {
                        HstQueryBuilder.create(scope)
                            .ofTypes(docType)
                            .orderByAscescending(sortBy)
                            .limit(pageSize)
                            .offset(pageSize * (crPage - 1))
                            .build(); 
                          hstQuery.addOrderByAscending(sortBy);
                      }
        }
      

      The above is really unhandy. I want to be able to write

       HstQueryBuilder.create(scope)
                            .ofTypes(docType)
                            .sortBy(sortOrder, sortBy)
                            .limit(pageSize)
                            .offset(pageSize * (crPage - 1))
                            .build(); 
      

      and if and only if sortOrder.equals("descending") (case insentive), then sort descending.

      NOTE I also want to rename orderByAscescending to sortByAscescending (also for descending).

      The above logic also goes for sort by case insensitive

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              aschrijvers Ard Schrijvers
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: