1
0
Fork 0

changed behaviour of sorting documents - front-end

This commit is contained in:
Heiko Kernbach 2014-08-21 16:43:17 +02:00
parent 19062d9d57
commit d17402f873
1 changed files with 7 additions and 2 deletions

View File

@ -94,9 +94,14 @@
query += this.setFiltersForQuery(bindVars);
// Sort result, only useful for a small number of docs
if (this.getTotal() < 12000) {
if (this.getSort() === '_key') {
query += " SORT TO_NUMBER(x." + this.getSort() + ") == 0 ? x."
+ this.getSort() + " : TO_NUMBER(x." + this.getSort() + ")";
}
else {
query += " SORT x." + this.getSort();
}
}
if (bindVars.count !== 'all') {
query += " LIMIT @offset, @count RETURN x";