Browse Source

Merge pull request #96 from pelias/bbox-optimize

Bbox optimize
pull/107/head
Harish Krishna 10 years ago
parent
commit
38e1c58c94
  1. 2
      package.json
  2. 68
      test/unit/query/search.js

2
package.json

@ -36,7 +36,7 @@
"express": "^4.8.8",
"geojson": "^0.2.0",
"geojson-extent": "^0.3.1",
"geopipes-elasticsearch-backend": "0.0.11",
"geopipes-elasticsearch-backend": "0.0.12",
"pelias-suggester-pipeline": "2.0.2",
"is-object": "^1.0.1",
"pelias-esclient": "0.0.25"

68
test/unit/query/search.js

@ -49,20 +49,6 @@ var sort = [
}
];
module.exports.tests.query = function(test, common) {
test('valid query', function(t) {
var query = generate({
input: 'test', size: 10,
lat: 29.49136, lon: -82.50622,
bbox: {
top: 47.47,
right: -61.84,
bottom: 11.51,
left: -103.16
},
layers: ['test']
});
var expected = {
'query': {
'filtered': {
@ -87,7 +73,8 @@ module.exports.tests.query = function(test, common) {
'bottom':'11.51',
'left': '-103.16'
},
'_cache': true
'_cache': true,
'type': 'indexed'
}
}
]
@ -100,6 +87,20 @@ module.exports.tests.query = function(test, common) {
'track_scores': true
};
module.exports.tests.query = function(test, common) {
test('valid query', function(t) {
var query = generate({
input: 'test', size: 10,
lat: 29.49136, lon: -82.50622,
bbox: {
top: 47.47,
right: -61.84,
bottom: 11.51,
left: -103.16
},
layers: ['test']
});
t.deepEqual(query, expected, 'valid search query');
t.end();
});
@ -116,43 +117,6 @@ module.exports.tests.query = function(test, common) {
layers: ['test']
});
var expected = {
'query': {
'filtered': {
'query': {
'bool': {
'must': [{
'match': {
'name.default': 'test'
}
}
]
}
},
'filter': {
'bool': {
'must': [
{
'geo_bounding_box': {
'center_point': {
'top': '47.47',
'right': '-61.84',
'bottom':'11.51',
'left': '-103.16'
},
'_cache': true
}
}
]
}
}
}
},
'sort': sort,
'size': 10,
'track_scores': true
};
t.deepEqual(query, expected, 'valid search query');
t.end();
});

Loading…
Cancel
Save