Browse Source

Merge pull request #156 from pelias/issue_139

Issue 139
faster
Peter Johnson a.k.a. insertcoffee 10 years ago
parent
commit
8e0892b35b
  1. 12
      package.json
  2. 7
      query/reverse.js
  3. 4
      test/unit/query/reverse.js
  4. 14
      test/unit/query/search.js

12
package.json

@ -37,16 +37,16 @@
"express": "^4.8.8", "express": "^4.8.8",
"geojson": "^0.2.1", "geojson": "^0.2.1",
"geojson-extent": "^0.3.1", "geojson-extent": "^0.3.1",
"geopipes-elasticsearch-backend": "0.0.12", "geopipes-elasticsearch-backend": "^0.2.0",
"is-object": "^1.0.1", "is-object": "^1.0.1",
"markdown": "0.5.0", "markdown": "0.5.0",
"pelias-esclient": "0.0.25", "microtime": "1.4.0",
"pelias-logger": "^0.0.8",
"through2": "0.6.5",
"morgan": "1.5.2", "morgan": "1.5.2",
"pelias-config": "^0.1.4", "pelias-config": "^0.1.4",
"microtime": "1.4.0", "pelias-esclient": "0.0.25",
"pelias-suggester-pipeline": "2.0.2" "pelias-logger": "^0.0.8",
"pelias-suggester-pipeline": "2.0.2",
"through2": "0.6.5"
}, },
"devDependencies": { "devDependencies": {
"ciao": "^0.3.4", "ciao": "^0.3.4",

7
query/reverse.js

@ -9,7 +9,12 @@ function generate( params ){
lon: params.lon lon: params.lon
}; };
var query = queries.distance( centroid, { size: params.size || 1 } ); var query = queries.distance( centroid, {
size: params.size || 1,
sort: true,
distance: '500km'
});
query.sort = query.sort.concat( sort( params ) ); query.sort = query.sort.concat( sort( params ) );
if ( params.categories && params.categories.length > 0 ) { if ( params.categories && params.categories.length > 0 ) {

4
test/unit/query/reverse.js

@ -78,7 +78,7 @@ module.exports.tests.query = function(test, common) {
'must': [ 'must': [
{ {
'geo_distance': { 'geo_distance': {
'distance': '50km', 'distance': '500km',
'distance_type': 'plane', 'distance_type': 'plane',
'optimize_bbox': 'indexed', 'optimize_bbox': 'indexed',
'_cache': true, '_cache': true,
@ -139,7 +139,7 @@ module.exports.tests.query = function(test, common) {
'must': [ 'must': [
{ {
'geo_distance': { 'geo_distance': {
'distance': '50km', 'distance': '500km',
'distance_type': 'plane', 'distance_type': 'plane',
'optimize_bbox': 'indexed', 'optimize_bbox': 'indexed',
'_cache': true, '_cache': true,

14
test/unit/query/search.js

@ -220,19 +220,7 @@ module.exports.tests.query = function(test, common) {
} }
} }
}, },
'sort': [ 'sort': ['_score'].concat(sort.slice(1)),
'_score',
{
'_geo_distance': {
'center_point': {
'lat': 29.49136,
'lon': -82.50622
},
'order': 'asc',
'unit': 'km'
}
}
].concat(sort.slice(1)),
'size': 10, 'size': 10,
'track_scores': true 'track_scores': true
}; };

Loading…
Cancel
Save