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) { if (bbox.length === 4) {
clean.bbox = bbox; clean.bbox = {
top : bbox[0],
right : bbox[1],
bottom: bbox[2],
left : bbox[3]
};
} else { } else {
return { return {
'error': true, 'error': true,

22
test/unit/query/search.js

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

Loading…
Cancel
Save