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. 112
      test/unit/query/search.js

2
package.json

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

112
test/unit/query/search.js

@ -49,6 +49,44 @@ var sort = [
} }
]; ];
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,
'type': 'indexed'
}
}
]
}
}
}
},
'sort': sort,
'size': 10,
'track_scores': true
};
module.exports.tests.query = function(test, common) { module.exports.tests.query = function(test, common) {
test('valid query', function(t) { test('valid query', function(t) {
var query = generate({ var query = generate({
@ -63,43 +101,6 @@ module.exports.tests.query = function(test, common) {
layers: ['test'] 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.deepEqual(query, expected, 'valid search query');
t.end(); t.end();
}); });
@ -115,43 +116,6 @@ module.exports.tests.query = function(test, common) {
}, },
layers: ['test'] 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.deepEqual(query, expected, 'valid search query');
t.end(); t.end();

Loading…
Cancel
Save