Skip to content

Commit

Permalink
docs: add new code comments and fix wrong ones
Browse files Browse the repository at this point in the history
  • Loading branch information
vesameskanen committed Jan 28, 2022
1 parent 1c057bc commit 3bfc4d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions controller/predicates/is_plain_multiword_name.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions routes/v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,15 @@ 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),
isPlainMultiWordName,
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,
Expand Down

0 comments on commit 3bfc4d9

Please sign in to comment.