diff --git a/test/unit/fixture/search_boundary_country.js b/test/unit/fixture/search_boundary_country.js new file mode 100644 index 00000000..94122797 --- /dev/null +++ b/test/unit/fixture/search_boundary_country.js @@ -0,0 +1,43 @@ + +module.exports = { + 'query': { + 'filtered': { + 'query': { + 'bool': { + 'must': [ + { + 'match': { + 'alpha3': { + 'analyzer': 'standard', + 'query': 'ABC' + } + } + }, + { + 'match': { + 'name.default': { + 'query': 'test', + 'boost': 1, + 'analyzer': 'peliasOneEdgeGram' + } + } + }], + 'should': [{ + 'match': { + 'phrase.default': { + 'query': 'test', + 'analyzer': 'peliasPhrase', + 'type': 'phrase', + 'boost': 1, + 'slop': 2 + } + } + }] + } + } + } + }, + 'sort': [ '_score' ], + 'size': 10, + 'track_scores': true +}; diff --git a/test/unit/query/search.js b/test/unit/query/search.js index 399fd20a..2b6194cf 100644 --- a/test/unit/query/search.js +++ b/test/unit/query/search.js @@ -136,6 +136,22 @@ module.exports.tests.query = function(test, common) { t.deepEqual(compiled, expected, 'valid search query'); t.end(); }); + + test('valid boundary.country search', function(t) { + var query = generate({ + text: 'test', size: 10, + layers: ['test'], + boundary: { country: 'ABC' } + }); + + var compiled = JSON.parse( JSON.stringify( query ) ); + var expected = require('../fixture/search_boundary_country'); + expected.sort = sort; + + t.deepEqual(compiled, expected, 'valid boundary.country query'); + t.end(); + }); + }; module.exports.all = function (tape, common) {