Skip to content

Commit

Permalink
Fix searchObjects when geolocation sorting is used
Browse files Browse the repository at this point in the history
  • Loading branch information
Razvan Botea committed Apr 28, 2016
1 parent c23a7e0 commit 3752524
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/database/elasticsearch_adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ ElasticSearchDB.prototype.searchObjects = function(options, callback) {
reqBody.sort[options.sort.field] = options.sort.order;
} else if (options.sort.type == 'geo') {
reqBody.sort._geo_distance = {};
reqBody.sort._geo_distance[options.sort.field] = {lat: sort.poi.lat || 0.0, lon: options.sort.poi.long || 0.0};
reqBody.sort._geo_distance[options.sort.field] = {lat: options.sort.poi.lat || 0.0, lon: options.sort.poi.long || 0.0};
reqBody.sort._geo_distance.order = options.sort.order;
}
}
Expand All @@ -264,8 +264,7 @@ ElasticSearchDB.prototype.searchObjects = function(options, callback) {
type: options.modelName,
body: reqBody,
from: options.offset,
size: options.limit,
search_type: options.sort
size: options.limit
}, function(err, results) {
if (err) return callback(err);

Expand Down

0 comments on commit 3752524

Please sign in to comment.