if (sortCriteria != null && !sortCriteria.isEmpty()) {
SortField[] sortField = new SortField[sortCriteria.size()];
int i = 0;
for (SortCriteria sc : sortCriteria) {
//TODO [anistor] sort type is not entirely correct
PropertyMetadata propMetadata = getPropertyMetadata(parsingResult.getTargetEntity(), sc.getAttributePath());
DocumentFieldMetadata fm = propMetadata.getFieldMetadata().iterator().next();
int sortType = fm.isNumeric() ? SortField.INT : SortField.STRING;
sortField[i++] = new SortField(sc.getAttributePath(), sortType, sc.getSortOrder() == SortOrder.DESC);
}
sort = new Sort(sortField);
}