Browse Source

elasticsearch-backend now only accepts vertices and not latlon as properties

pull/60/head
Harish Krishna 10 years ago
parent
commit
245abd7809
  1. 7
      sanitiser/_latlonzoom.js
  2. 22
      test/unit/query/search.js

7
sanitiser/_latlonzoom.js

@ -57,7 +57,12 @@ function sanitize( req ){
}
});
if (bbox.length === 4) {
clean.bbox = bbox;
clean.bbox = {
top : bbox[0],
right : bbox[1],
bottom: bbox[2],
left : bbox[3]
};
} else {
return {
'error': true,

22
test/unit/query/search.js

@ -15,7 +15,12 @@ module.exports.tests.query = function(test, common) {
var query = generate({
input: 'test', size: 10,
lat: 29.49136, lon: -82.50622,
bbox: [47.47, -61.84, 11.51, -103.16],
bbox: {
top: 47.47,
right: -61.84,
bottom: 11.51,
left: -103.16
},
// bbox: { //TODO write a test where no bbox is provided
// bottom_left: {
// lat: 11.51053655297385,
@ -47,15 +52,12 @@ module.exports.tests.query = function(test, common) {
{
'geo_bounding_box': {
'center_point': {
'top_right': {
'lat': '47.47',
'lon': '-61.84'
'top': '47.47',
'right': '-61.84',
'bottom':'11.51',
'left': '-103.16'
},
'bottom_left': {
'lat': '11.51',
'lon': '-103.16'
}
}
'_cache': true
}
}
]
@ -66,7 +68,7 @@ module.exports.tests.query = function(test, common) {
'sort': [],
'size': 10
};
console.log(JSON.stringify(query, 2, null));
t.deepEqual(query, expected, 'valid search query');
t.end();
});

Loading…
Cancel
Save