Browse Source

added fixture for boundary.country in query building

pull/253/head
Stephen Hess 9 years ago
parent
commit
a4c43ee482
  1. 43
      test/unit/fixture/search_boundary_country.js
  2. 16
      test/unit/query/search.js

43
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
};

16
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) {

Loading…
Cancel
Save