Browse Source

no address parsing required if there are only 2 or less tokens

pull/169/head
Harish Krishna 9 years ago
parent
commit
a4d09f8e12
  1. 9
      sanitiser/_input.js

9
sanitiser/_input.js

@ -38,10 +38,15 @@ function sanitize( req ){
parsedAddress0.admin_parts = params.input.substring(delimIndex + 1).trim();
}
// set target_layer if input length < 3 characters
if (params.input.length <= 3) {
var splitOnSpace = params.input.split(' ');
var splitOnDelim = params.input.split(delim);
// set target_layer if input length <= 3 characters
if (params.input.length <= 3 ) {
// no address parsing required
parsedAddress2.target_layer = get_layers(['admin']);
} else if (splitOnDelim.length < 3 || splitOnSpace.length < 3) {
// no need to hit address layers if there's only two tokens
parsedAddress2.target_layer = get_layers(['admin', 'poi']);
} else {
// address parsing
parsedAddress1 = parser( params.input );

Loading…
Cancel
Save