diff --git a/helper/layers.js b/helper/layers.js index 8efce727..aa625a6e 100644 --- a/helper/layers.js +++ b/helper/layers.js @@ -13,7 +13,7 @@ module.exports = function(alias_layers) { }; layers = expand_aliases('poi', layers, ['geoname','osmnode','osmway']); - layers = expand_aliases('admin', layers, ['admin0','admin1','admin2','neighborhood']); + layers = expand_aliases('admin', layers, ['admin0','admin1','admin2','neighborhood','locality','local_admin']); layers = expand_aliases('address', layers, ['osmaddress','openaddresses']); // de-dupe diff --git a/query/indeces.js b/query/indeces.js index 04d744b6..1fff5961 100644 --- a/query/indeces.js +++ b/query/indeces.js @@ -9,6 +9,8 @@ module.exports = [ 'admin1', 'admin2', 'neighborhood', + 'locality', + 'local_admin', 'osmaddress', 'openaddresses' ]; \ No newline at end of file diff --git a/test/unit/query/indeces.js b/test/unit/query/indeces.js index 924aed69..fd552809 100644 --- a/test/unit/query/indeces.js +++ b/test/unit/query/indeces.js @@ -6,7 +6,7 @@ module.exports.tests = {}; module.exports.tests.interface = function(test, common) { test('valid interface', function(t) { t.true(Array.isArray(indeces), 'valid array'); - t.equal(indeces.length, 9, 'valid array'); + t.equal(indeces.length, 11, 'valid array'); t.end(); }); }; diff --git a/test/unit/sanitiser/coarse.js b/test/unit/sanitiser/coarse.js index f389b423..3409cbc4 100644 --- a/test/unit/sanitiser/coarse.js +++ b/test/unit/sanitiser/coarse.js @@ -2,7 +2,7 @@ var coarse = require('../../../sanitiser/coarse'), _sanitize = coarse.sanitize, middleware = coarse.middleware, - valid_layers = [ 'admin0', 'admin1', 'admin2', 'neighborhood' ], + valid_layers = [ 'admin0', 'admin1', 'admin2', 'neighborhood', 'locality', 'local_admin' ], sanitize = function(query, cb) { _sanitize({'query':query}, cb); }; module.exports.tests = {}; @@ -51,7 +51,7 @@ module.exports.tests.middleware_success = function(test, common) { var defaultClean = { input: 'test', size: 10, - layers: [ 'admin0', 'admin1', 'admin2', 'neighborhood' ], + layers: [ 'admin0', 'admin1', 'admin2', 'neighborhood', 'locality', 'local_admin' ], lat: 0, lon: 0 }; diff --git a/test/unit/sanitiser/suggest.js b/test/unit/sanitiser/suggest.js index a576f6de..88e75d56 100644 --- a/test/unit/sanitiser/suggest.js +++ b/test/unit/sanitiser/suggest.js @@ -7,7 +7,7 @@ var suggest = require('../../../sanitiser/suggest'), defaultClean = { input: 'test', lat:0, layers: [ 'geoname', 'osmnode', 'osmway', 'admin0', 'admin1', 'admin2', 'neighborhood', - 'osmaddress', 'openaddresses' ], + 'locality', 'local_admin', 'osmaddress', 'openaddresses' ], lon: 0, size: 10 }, @@ -258,7 +258,7 @@ module.exports.tests.sanitize_layers = function(test, common) { }); }); test('admin (alias) layer', function(t) { - var admin_layers = ['admin0','admin1','admin2','neighborhood']; + var admin_layers = ['admin0','admin1','admin2','neighborhood','locality','local_admin']; sanitize({ layers: 'admin', input: 'test', lat: 0, lon: 0 }, function( err, clean ){ t.deepEqual(clean.layers, admin_layers, 'admin layers set'); t.end(); @@ -280,7 +280,7 @@ module.exports.tests.sanitize_layers = function(test, common) { }); }); test('admin alias layer plus regular layers', function(t) { - var admin_layers = ['admin0','admin1','admin2','neighborhood']; + var admin_layers = ['admin0','admin1','admin2','neighborhood','locality','local_admin']; var reg_layers = ['geoname', 'osmway']; sanitize({ layers: 'admin,geoname,osmway', input: 'test', lat: 0, lon: 0 }, function( err, clean ){ t.deepEqual(clean.layers, reg_layers.concat(admin_layers), 'admin + regular layers set'); @@ -303,7 +303,7 @@ module.exports.tests.sanitize_layers = function(test, common) { }); }); test('multiple alias layers (no duplicates)', function(t) { - var alias_layers = ['geoname','osmnode','osmway','admin0','admin1','admin2','neighborhood']; + var alias_layers = ['geoname','osmnode','osmway','admin0','admin1','admin2','neighborhood','locality','local_admin']; sanitize({ layers: 'poi,admin', input: 'test', lat: 0, lon: 0 }, function( err, clean ){ t.deepEqual(clean.layers, alias_layers, 'all layers found (no duplicates)'); t.end();