Browse Source

Remove layer configuration based on address parsing

This code doesn't seem like it will be triggered very often (due to it
comapring space delimited words with comma delimited words from the text
field), and also has the potential to cause quite a bit of weird
behavior.
pull/221/head
Julian Simioni 9 years ago
parent
commit
1fae622c39
  1. 11
      helper/query_parser.js
  2. 4
      test/unit/helper/query_parser.js

11
helper/query_parser.js

@ -37,14 +37,9 @@ module.exports = function(query) {
};
var getAddressParts = function(query) {
// address parsing
var address = parser( query );
// set target_layer if input suggests no address
if (address.text === address.regions.join(' ') && !hasNumber) {
address.target_layer = get_layers(['admin', 'poi']);
}
return address;
// perform full address parsing
// except on queries so short they obviously can't contain an address
return parser( query );
};
var addressWithAdminParts = getAdminPartsBySplittingOnDelim(query);

4
test/unit/helper/query_parser.js

@ -137,10 +137,6 @@ module.exports.tests.parse_address = function(test, common) {
t.equal(address.postalcode, query.zip, 'correct postal code (' + query.zip + ')');
}
if (address.text === address.regions.join(' ')) {
t.deepEqual(address.target_layer, query.target_layer, 'admin_parts set correctly to ' + query.target_layer.join(', '));
}
t.end();
});
};

Loading…
Cancel
Save