Append sorting parameters to {@link SolrQuery}

@param solrQuery
@param sort
12874
protected void appendSort(SolrQuery solrQuery, @Nullable Sort sort, @Nullable Class<?> domainType) {

		if (sort == null) {
			return;
		}

		for (Order order : sort) {
			solrQuery.addSort(getMappedFieldName(order.getProperty(), domainType),
					order.isAscending() ? ORDER.asc : ORDER.desc);
		}
	}
375577
@Override
    public Iterable<T> findAll(@NonNull Sort sort) {
        Assert.notNull(sort, "sort of findAll should not be null");
        final DocumentQuery query = new DocumentQuery(Criteria.getInstance(CriteriaType.ALL)).with(sort);

        return operation.find(query, information.getJavaType(), information.getCollectionName());
    }
98574
private static void addOrderPossiblyNested(CriteriaQuery query,
                                               From queryRoot,
                                               CriteriaBuilder criteriaBuilder,
                                               PersistentEntity entity,
                                               String sort,
                                               String order,
                                               boolean ignoreCase) {
        int firstDotPos = sort.indexOf(".");
        if (firstDotPos == -1) {
            addOrder(entity, query, queryRoot, criteriaBuilder, sort, order, ignoreCase);
        } else { // nested property
            String sortHead = sort.substring(0, firstDotPos);
            String sortTail = sort.substring(firstDotPos + 1);
            PersistentProperty property = entity.getPropertyByName(sortHead);
            if (property instanceof Embedded) {
                // embedded objects cannot reference entities (at time of writing), so no more recursion needed
                addOrder(entity, query, queryRoot, criteriaBuilder, sort, order, ignoreCase);
            } else if (property instanceof Association) {
                Association a = (Association) property;
                final Join join = queryRoot.join(sortHead);
                PersistentEntity associatedEntity = a.getAssociatedEntity();
                Class<?> propertyTargetClass = associatedEntity.getJavaClass();
                addOrderPossiblyNested(query, join, criteriaBuilder, associatedEntity, sortTail, order, ignoreCase); // Recurse on nested sort
            }
        }
    }
1345104
public void addRegexQueryParameters( List<String> inputParams, String listId, String fieldName, boolean union ) {
        addRegexQueryParameters(inputParams, listId, fieldName, null, union);
    }
1070827
protected final List<T> findSortedByQuery(String query, String sort, Object... params) {
        return this.dataAccess.findSortedByQuery(query, sort, params);
    }
924031
public function addSorting($sort, $order = SearchQuery::SORT_ASC)
    {
        $this->searchQuery->addSorting($sort, $order);

        return $this;
    }
1108642
public CmsSolrResultList search(CmsObject cms, SolrQuery query) throws CmsSearchException {

        return search(cms, CmsEncoder.decode(query.toString()));
    }
458569
public String addSortParams(boolean bIncludeFileName, boolean bForceUniqueKey)
    {
        String strSort = super.addSortParams(bIncludeFileName, bForceUniqueKey);
        if (strSort.length() > 0)
            return strSort;     // Sort string was specified for this "QueryRecord"
        Record stmtTable = this.getRecordlistAt(0);
        if (stmtTable != null)
            strSort += stmtTable.addSortParams(bIncludeFileName, bForceUniqueKey);
        return strSort;
    }
171374
public <T> void addRangeQueryParameters(List<? extends Object> paramList, String listId, Class<T> type, String fieldName, String joinClause, boolean union ) {
        List<T> listIdParams;
        if( paramList != null && paramList.size() > 0 ) { 
            Object inputObject = paramList.get(0);
            if( inputObject == null ) { 
                inputObject = paramList.get(1);
                if( inputObject == null ) { 
                    return;
                }
            }  
            listIdParams = checkAndConvertListToType(paramList, inputObject, listId, type);
        } else { 
            return;
        }
        
        T min = listIdParams.get(0);
        T max = listIdParams.get(1);
        Map<String, T> paramNameMinMaxMap = new HashMap<String, T>(2);
        StringBuilder queryClause = new StringBuilder("( " );
        if( joinClause != null ) { 
           queryClause.append("( "); 
        } 
        queryClause.append(fieldName);
        if( min == null ) { 
          if( max == null ) { 
              return;
          } else { 
              // only max
              String maxParamName = generateParamName();
              queryClause.append(" <= :" + maxParamName + " " );
              paramNameMinMaxMap.put(maxParamName, max);
          }
        } else if( max == null ) { 
            // only min
            String minParamName = generateParamName();
            queryClause.append(" >= :" + minParamName + " ");
            paramNameMinMaxMap.put(minParamName, min);
        } else { 
            // both min and max
            String minParamName = generateParamName();
            String maxParamName = generateParamName();
            if( union ) { 
                queryClause.append(" >= :" + minParamName + " OR " + fieldName + " <= :" + maxParamName + " " );
            } else { 
                queryClause.append(" BETWEEN :" + minParamName + " AND :" + maxParamName + " " );
            }
            paramNameMinMaxMap.put(minParamName, min);
            paramNameMinMaxMap.put(maxParamName, max);
        } 
        if( joinClause != null ) { 
            queryClause.append(") and " + joinClause.trim() + " ");
        }
        queryClause.append(")");
        
        // add query string to query builder and fill params map
        internalAddToQueryBuilder(queryClause.toString(), union);
        for( Entry<String, T> nameMinMaxEntry : paramNameMinMaxMap.entrySet() ) { 
            addNamedQueryParam(nameMinMaxEntry.getKey(), nameMinMaxEntry.getValue());
        }
        queryBuilderModificationCleanup();
    }
1198052
public void sortCategories(String sortParams, String filter) {

        List<CmsCategoryBean> categories;
        SortParams sort = SortParams.valueOf(sortParams);
        switch (sort) {
            case tree:
                m_handler.onUpdateCategoriesTree(m_dialogBean.getCategories(), m_searchObject.getCategories());
                break;
            case title_asc:
                categories = getFilteredCategories(filter);
                Collections.sort(categories, new CmsComparatorTitle(true));
                m_handler.onUpdateCategoriesList(categories, m_searchObject.getCategories());
                break;
            case title_desc:
                categories = getFilteredCategories(filter);
                Collections.sort(categories, new CmsComparatorTitle(false));
                m_handler.onUpdateCategoriesList(categories, m_searchObject.getCategories());
                break;
            case type_asc:
            case type_desc:
            case path_asc:
            case path_desc:
            case dateLastModified_asc:
            case dateLastModified_desc:

            default:
        }
    }
1207654
def query_sort(query, options)
      query.order(options[:order]) if options[:order]
      query.order(options[:desc_order], :desc) if options[:desc_order]
      query
    end
593256
public static function addOrderSort($sort, $table, &$query)
    {
        if (!empty($sort)) {
            $sorts = explode(',', $sort);
            foreach ($sorts as $sort) {
                if (!strpos($sort, '.')) {
                    preg_match('/\w+\s+(DESC|ASC)/', $sort, $sort_field);
                    $type = !empty($sort_field) ? trim($sort_field[1]) : 'DESC';
                    $field = !empty($sort_field) ? trim(substr($sort, 0, -strlen($type))) : trim($sort);
                    $order[$table . '.' . $field] = $type == 'DESC' ? SORT_DESC : SORT_ASC;
                } else {
                    $sort_table = trim(substr($sort, 0, strrpos($sort, '.')));
                    preg_match('/\w+\.\w+\s+(DESC|ASC)/', $sort, $sort_field);
                    $type = trim($sort_field[1]);
                    $field = trim(substr(substr($sort, strrpos($sort, '.') + 1), 0, -strlen($type)));
                    $order[trim($sort_table) . '.' . $field] = $type == 'DESC' ? SORT_DESC : SORT_ASC;;
                    $query->select[] = explode(' ', $sort_field[0])[0];
                    $query->joinWith($sort_table);
                }
            }
            $query->select[] = $table . ".*";
        }
        $query->orderBy($order);
    }
560180
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
    private static SortedMap<String, List<String>> asMap(final String query) {
        final SortedMap<String, List<String>> params = new TreeMap<>();
        if (query != null) {
            for (final String pair : query.split("&")) {
                final String[] parts = pair.split("=", 2);
                final String key = Href.decode(parts[0]);
                final String value;
                if (parts.length > 1) {
                    value = Href.decode(parts[1]);
                } else {
                    value = "";
                }
                if (!params.containsKey(key)) {
                    params.put(key, new LinkedList<>());
                }
                params.get(key).add(value);
            }
        }
        return params;
    }
1050580
public static Sort sort(Sort... sort) {
        if (sort.length == 1) {
            return sort[0];
        } else {
            Sort s = new Sort(true);
            for (Sort x : sort) {
                ((ArrayNode) s.node).add(x.toJson());
            }
            return s;
        }
    }
868835
public Sort and(final Sort sort) {

    Assert.notNull(sort, "Sort must not be null!");

    final ArrayList<Order> these = new ArrayList<>(orders);

    for (final Order order : sort) {
      these.add(order);
    }

    return Sort.by(these);
  }
906373
public void sort(Comparator<T> sort) {
		ArrayList<T> tmp = new ArrayList<T>();
		
        for( Collection<T> page : pages ) {
			tmp.addAll(page);
		}
		setup(tmp, pageSize, sort);
	}
323678
public CoreRemoteFindIterableImpl<DocumentT, ResultT> sort(@Nullable final Bson sort) {
    findOptions.sort(sort);
    return this;
  }