1
0
Fork 0

Fixed sorting of documents to use internal total function

This commit is contained in:
Michael Hackstein 2014-07-07 09:31:54 +02:00
parent c588a1ca4c
commit 8fe6f0260d
1 changed files with 1 additions and 3 deletions

View File

@ -5,7 +5,6 @@
window.arangoDocuments = window.PaginatedCollection.extend({
collectionID: 1,
collectionCount: null,
filters: [],
@ -23,7 +22,6 @@
async: false,
success: function(data) {
self.setTotal(data.count);
self.collectionCount = data.count;
}
});
},
@ -79,7 +77,7 @@
query = "FOR x in @@collection";
query += this.setFiltersForQuery(bindVars);
// Sort result, only useful for a small number of docs
if (this.collectionCount !== null && this.collectionCount < 10000) {
if (this.getTotal() < 10000) {
query += " SORT TO_NUMBER(x._key) == 0 ? x._key : TO_NUMBER(x._key)";
}
query += " LIMIT @offset, @count RETURN x";