|
|
|
@ -100,9 +100,10 @@ function checkForDealBreakers(req, hit) {
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (check.assigned(req.clean.parsed_text.postalcode) && check.assigned(hit.address) && |
|
|
|
|
req.clean.parsed_text.postalcode !== hit.address.zip) { |
|
|
|
|
logger.debug('[confidence][deal-breaker]: postalcode !== zip (' + req.clean.parsed_text.postalcode + ' !== ' + hit.address.zip + ')'); |
|
|
|
|
if (check.assigned(req.clean.parsed_text.postalcode) && check.assigned(hit.address_parts) && |
|
|
|
|
req.clean.parsed_text.postalcode !== hit.address_parts.zip) { |
|
|
|
|
logger.debug('[confidence][deal-breaker]: postalcode !== zip (' + req.clean.parsed_text.postalcode + |
|
|
|
|
' !== ' + hit.address_parts.zip + ')'); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -155,8 +156,8 @@ function checkName(text, parsed_text, hit) {
|
|
|
|
|
*/ |
|
|
|
|
function checkQueryType(text, hit) { |
|
|
|
|
if (check.assigned(text) && check.assigned(text.number) && |
|
|
|
|
(check.undefined(hit.address) || |
|
|
|
|
(check.assigned(hit.address) && check.undefined(hit.address.number)))) { |
|
|
|
|
(check.undefined(hit.address_parts) || |
|
|
|
|
(check.assigned(hit.address_parts) && check.undefined(hit.address_parts.number)))) { |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
return 1; |
|
|
|
@ -206,10 +207,10 @@ function propMatch(textProp, hitProp, expectEnriched) {
|
|
|
|
|
* @param {string} [text.state] |
|
|
|
|
* @param {string} [text.country] |
|
|
|
|
* @param {object} hit |
|
|
|
|
* @param {object} [hit.address] |
|
|
|
|
* @param {string|number} [hit.address.number] |
|
|
|
|
* @param {string} [hit.address.street] |
|
|
|
|
* @param {string|number} [hit.address.zip] |
|
|
|
|
* @param {object} [hit.address_parts] |
|
|
|
|
* @param {string|number} [hit.address_parts.number] |
|
|
|
|
* @param {string} [hit.address_parts.street] |
|
|
|
|
* @param {string|number} [hit.address_parts.zip] |
|
|
|
|
* @param {Array} [hit.parent.region_a] |
|
|
|
|
* @param {Array} [hit.parent.country_a] |
|
|
|
|
* @returns {number} |
|
|
|
@ -219,9 +220,9 @@ function checkAddress(text, hit) {
|
|
|
|
|
var res = 0; |
|
|
|
|
|
|
|
|
|
if (check.assigned(text) && check.assigned(text.number) && check.assigned(text.street)) { |
|
|
|
|
res += propMatch(text.number, (hit.address ? hit.address.number : null), false); |
|
|
|
|
res += propMatch(text.street, (hit.address ? hit.address.street : null), false); |
|
|
|
|
res += propMatch(text.postalcode, (hit.address ? hit.address.zip: null), true); |
|
|
|
|
res += propMatch(text.number, (hit.address_parts ? hit.address_parts.number : null), false); |
|
|
|
|
res += propMatch(text.street, (hit.address_parts ? hit.address_parts.street : null), false); |
|
|
|
|
res += propMatch(text.postalcode, (hit.address_parts ? hit.address_parts.zip: null), true); |
|
|
|
|
res += propMatch(text.state, hit.parent.region_a[0], true); |
|
|
|
|
res += propMatch(text.country, hit.parent.country_a[0], true); |
|
|
|
|
|
|
|
|
|