-
-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #469 from pelias/reverse_api
bugfix: enable support for ?sources= filtering on /reverse
- Loading branch information
Showing
5 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
#> layer alias | ||
path: '/v1/reverse?point.lat=1&point.lon=2&layers=address' | ||
|
||
#? 200 ok | ||
response.statusCode.should.be.equal 200 | ||
response.should.have.header 'charset', 'utf8' | ||
response.should.have.header 'content-type', 'application/json; charset=utf-8' | ||
|
||
#? valid geocoding block | ||
should.exist json.geocoding | ||
should.exist json.geocoding.version | ||
should.exist json.geocoding.attribution | ||
should.exist json.geocoding.query | ||
should.exist json.geocoding.engine | ||
should.exist json.geocoding.engine.name | ||
should.exist json.geocoding.engine.author | ||
should.exist json.geocoding.engine.version | ||
should.exist json.geocoding.timestamp | ||
|
||
#? valid geojson | ||
json.type.should.be.equal 'FeatureCollection' | ||
json.features.should.be.instanceof Array | ||
|
||
#? expected errors | ||
should.not.exist json.geocoding.errors | ||
|
||
#? expected warnings | ||
should.not.exist json.geocoding.warnings | ||
|
||
#? inputs | ||
json.geocoding.query['size'].should.eql 10 | ||
json.geocoding.query.layers.should.eql ["address"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
var vs = require('../../../query/reverse_defaults'); | ||
|
||
module.exports = { | ||
'query': { | ||
'filtered': { | ||
'query': { | ||
'bool': { | ||
'must': [] | ||
} | ||
}, | ||
'filter': { | ||
'bool': { | ||
'must': [ | ||
{ | ||
'geo_distance': { | ||
'distance': '500km', | ||
'distance_type': 'plane', | ||
'optimize_bbox': 'indexed', | ||
'_cache': true, | ||
'center_point': { | ||
'lat': 29.49136, | ||
'lon': -82.50622 | ||
} | ||
} | ||
}, | ||
{ | ||
'terms': { | ||
'source': ['test'] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
'sort': [ | ||
'_score', | ||
{ | ||
'_geo_distance': { | ||
'center_point': { | ||
'lat': 29.49136, | ||
'lon': -82.50622 | ||
}, | ||
'order': 'asc', | ||
'distance_type': 'plane' | ||
} | ||
} | ||
], | ||
'size': vs.size, | ||
'track_scores': true | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters