// orderBy param
ASort sort = null;
String orderByParam = getParameter(params,"orderBy");
if ((orderByParam != null) && !"".equals(orderByParam)) {
String[] sortingCriteria = orderByParam.split(",");
sort = new ScoreSort();
for (int i = (sortingCriteria.length-1); i >= 0; i--) {
String sortingCriterion = sortingCriteria[i];
String parts[] = sortingCriterion.split(":");
String sortField = parts[0];
FieldSort.OrderType orderType = FieldSort.OrderType.STRING;
boolean reverse = false;
for (int p = 1; p < parts.length; p++) {
String part = parts[p].toLowerCase();
if ("reverse".equals(part) || "reversed".equals(part)) {
reverse = true;
continue;
}
if ("int".equals(part)) {
orderType = FieldSort.OrderType.INT;
continue;
}
if ("long".equals(part)) {
orderType = FieldSort.OrderType.LONG;
continue;
}
if ("float".equals(part)) {
orderType = FieldSort.OrderType.FLOAT;
continue;
}
}
if ("score".equals(sortField)) {
sort = new ScoreSort();
} else {
sort = new FieldSort(reverse, sortField, orderType, sort);
}
}
}