|
|
@ -89,6 +89,7 @@ function checkFallbackLevel(req, hit) { |
|
|
|
default: |
|
|
|
default: |
|
|
|
return 0.1; |
|
|
|
return 0.1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
hit.match_type = 'exact'; |
|
|
|
hit.match_type = 'exact'; |
|
|
@ -96,11 +97,9 @@ function checkFallbackLevel(req, hit) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function checkFallbackOccurred(req, hit) { |
|
|
|
function checkFallbackOccurred(req, hit) { |
|
|
|
// at this time we only do this for address queries, so keep this simple
|
|
|
|
|
|
|
|
// TODO: add other layer checks once we start handling disambiguation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (requestedAddress(req) && hit.layer !== 'address') || |
|
|
|
return (requestedAddress(req) && hit.layer !== 'address') || |
|
|
|
(requestedStreet(req) && hit.layer !== 'street'); |
|
|
|
(requestedStreet(req) && hit.layer !== 'street') || |
|
|
|
|
|
|
|
(requestedCity(req) && hit.layer !== 'locality'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function requestedAddress(req) { |
|
|
|
function requestedAddress(req) { |
|
|
@ -115,4 +114,8 @@ function requestedStreet(req) { |
|
|
|
req.clean.parsed_text.hasOwnProperty('street'); |
|
|
|
req.clean.parsed_text.hasOwnProperty('street'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function requestedCity(req) { |
|
|
|
|
|
|
|
return req.clean.parsed_text.hasOwnProperty('city'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
module.exports = setup; |
|
|
|
module.exports = setup; |
|
|
|