From e95c2efb54db9683e665a6973cfebc9ebafd7935 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Mon, 13 Jul 2015 17:22:37 +0200 Subject: [PATCH] resolves #139 --- package.json | 12 ++++++------ query/reverse.js | 2 +- test/unit/query/search.js | 14 +------------- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index fcbfdae7..55f93115 100644 --- a/package.json +++ b/package.json @@ -37,16 +37,16 @@ "express": "^4.8.8", "geojson": "^0.2.1", "geojson-extent": "^0.3.1", - "geopipes-elasticsearch-backend": "0.0.12", + "geopipes-elasticsearch-backend": "^0.2.0", "is-object": "^1.0.1", "markdown": "0.5.0", - "pelias-esclient": "0.0.25", - "pelias-logger": "^0.0.8", - "through2": "0.6.5", + "microtime": "1.4.0", "morgan": "1.5.2", "pelias-config": "^0.1.4", - "microtime": "1.4.0", - "pelias-suggester-pipeline": "2.0.2" + "pelias-esclient": "0.0.25", + "pelias-logger": "^0.0.8", + "pelias-suggester-pipeline": "2.0.2", + "through2": "0.6.5" }, "devDependencies": { "ciao": "^0.3.4", diff --git a/query/reverse.js b/query/reverse.js index 7de12ba8..7759864a 100644 --- a/query/reverse.js +++ b/query/reverse.js @@ -9,7 +9,7 @@ function generate( params ){ lon: params.lon }; - var query = queries.distance( centroid, { size: params.size || 1 } ); + var query = queries.distance( centroid, { size: params.size || 1, sort: true } ); query.sort = query.sort.concat( sort( params ) ); if ( params.categories && params.categories.length > 0 ) { diff --git a/test/unit/query/search.js b/test/unit/query/search.js index 7665f876..d4224dde 100644 --- a/test/unit/query/search.js +++ b/test/unit/query/search.js @@ -220,19 +220,7 @@ module.exports.tests.query = function(test, common) { } } }, - 'sort': [ - '_score', - { - '_geo_distance': { - 'center_point': { - 'lat': 29.49136, - 'lon': -82.50622 - }, - 'order': 'asc', - 'unit': 'km' - } - } - ].concat(sort.slice(1)), + 'sort': ['_score'].concat(sort.slice(1)), 'size': 10, 'track_scores': true };