From 1d513c0811e444921ab1f93b6439cac8d75cc189 Mon Sep 17 00:00:00 2001 From: Razvan Botea Date: Fri, 25 Mar 2016 16:28:00 +0200 Subject: [PATCH] Made the sort backwards compatible with earlier versions --- lib/database/elasticsearch_adapter.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/database/elasticsearch_adapter.js b/lib/database/elasticsearch_adapter.js index 641f5b3..cb3e75d 100644 --- a/lib/database/elasticsearch_adapter.js +++ b/lib/database/elasticsearch_adapter.js @@ -1082,7 +1082,9 @@ ElasticSearchDB.prototype.modelSearch = function(channel, sort, offset, limit, c if (sort) { elasticSearchQuery.sort = {}; - if (sort.type == 'default') { + if (!sort.type) { + elasticSearchQuery.sort = [sort]; + } else if (sort.type == 'default') { elasticSearchQuery.sort[sort.field] = sort.order; } else if (sort.type == 'geo') { elasticSearchQuery.sort._geo_distance = {};