|
|
|
@ -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(); |
|
|
|
|
}); |
|
|
|
|