|
|
|
@ -1,6 +1,5 @@
|
|
|
|
|
var check = require('check-types'); |
|
|
|
|
var parser = require('addressit'); |
|
|
|
|
var extend = require('extend'); |
|
|
|
|
var _ = require('lodash'); |
|
|
|
|
var logger = require('pelias-logger').get('api'); |
|
|
|
|
|
|
|
|
@ -82,8 +81,8 @@ function parse(query) {
|
|
|
|
|
var addressWithAdminParts = getAdminPartsBySplittingOnDelim(queryParts); |
|
|
|
|
var addressWithAddressParts= getAddressParts(queryParts.join(DELIM + ' ')); |
|
|
|
|
|
|
|
|
|
var parsedAddress = extend(addressWithAdminParts, |
|
|
|
|
addressWithAddressParts); |
|
|
|
|
// combine the 2 objects
|
|
|
|
|
_.extend(addressWithAdminParts, addressWithAddressParts); |
|
|
|
|
|
|
|
|
|
var address_parts = [ 'name', |
|
|
|
|
'number', |
|
|
|
@ -99,8 +98,8 @@ function parse(query) {
|
|
|
|
|
var parsed_text = {}; |
|
|
|
|
|
|
|
|
|
address_parts.forEach(function(part){ |
|
|
|
|
if (parsedAddress[part]) { |
|
|
|
|
parsed_text[part] = parsedAddress[part]; |
|
|
|
|
if (addressWithAdminParts[part]) { |
|
|
|
|
parsed_text[part] = addressWithAdminParts[part]; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|