Skip to content

Commit

Permalink
Made the sort backwards compatible with earlier versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Razvan Botea committed Mar 25, 2016
1 parent 9436765 commit 1d513c0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/database/elasticsearch_adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand Down

0 comments on commit 1d513c0

Please sign in to comment.