From 3bfc4d9160ae13ffb1a4754143e8849963992a4f Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 28 Jan 2022 11:38:38 +0200 Subject: [PATCH] docs: add new code comments and fix wrong ones --- controller/predicates/is_plain_multiword_name.js | 2 ++ routes/v1.js | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/controller/predicates/is_plain_multiword_name.js b/controller/predicates/is_plain_multiword_name.js index acbd588e..3b56cfaa 100644 --- a/controller/predicates/is_plain_multiword_name.js +++ b/controller/predicates/is_plain_multiword_name.js @@ -2,11 +2,13 @@ const _ = require('lodash'); module.exports = (req, res) => { if (req.clean.hasOwnProperty('parsed_text')) { + // do not match name with admins if name is a street addr or explict admin value was parsed from text if(req.clean.parsed_text.hasOwnProperty('number') && req.clean.parsed_text.hasOwnProperty('street') || req.clean.parsed_text.regions ) { return false; } + // no street, no admins - maybe the name itself includes an admin: 'Vilppulan asema' return req.clean.parsed_text.name && req.clean.parsed_text.name.includes(' '); } return false; diff --git a/routes/v1.js b/routes/v1.js index 542ddc1d..3fdf63bf 100644 --- a/routes/v1.js +++ b/routes/v1.js @@ -245,7 +245,7 @@ function addRoutes(app, peliasConfig) { isAddressItParse ); - // call very old prod query if addressit was the parser + // try genitive matching if search seems to need it const genitiveQueryShouldExecute = all( not(hasRequestErrors), not(hasGoodMatch), @@ -253,7 +253,7 @@ function addRoutes(app, peliasConfig) { isAddressItParse ); - // call very old prod query if addressit was the parser + // try fuzzy matching if perfect match was not found const fuzzyQueryShouldExecute = all( not(hasRequestErrors), isAddressItParse,