Skip to content

Commit

Permalink
chore: remove logic related to parser selection
Browse files Browse the repository at this point in the history
We always combine libpostal and addressit
  • Loading branch information
vesameskanen committed Jan 28, 2022
1 parent 3bfc4d9 commit bca8642
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
13 changes: 2 additions & 11 deletions routes/v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ const hasRequestErrors = require('../controller/predicates/has_request_errors');
const isCoarseReverse = require('../controller/predicates/is_coarse_reverse');
const isAdminOnlyAnalysis = require('../controller/predicates/is_admin_only_analysis');
const hasResultsAtLayers = require('../controller/predicates/has_results_at_layers');
const isAddressItParse = require('../controller/predicates/is_addressit_parse');
const isPlainMultiWordName = require('../controller/predicates/is_plain_multiword_name');
const hasRequestCategories = require('../controller/predicates/has_request_parameter')('categories');
const isOnlyNonAdminLayers = require('../controller/predicates/is_only_non_admin_layers');
Expand Down Expand Up @@ -239,24 +238,16 @@ function addRoutes(app, peliasConfig) {
not(placeholderShouldHaveExecuted)
);

// call very old prod query if addressit was the parser
const oldProdQueryShouldExecute = all(
not(hasRequestErrors),
isAddressItParse
);

// try genitive matching if search seems to need it
const genitiveQueryShouldExecute = all(
not(hasRequestErrors),
not(hasGoodMatch),
isPlainMultiWordName,
isAddressItParse
isPlainMultiWordName
);

// try fuzzy matching if perfect match was not found
const fuzzyQueryShouldExecute = all(
not(hasRequestErrors),
isAddressItParse,
not(hasGoodMatch)
);

Expand Down Expand Up @@ -314,7 +305,7 @@ function addRoutes(app, peliasConfig) {
controllers.placeholder(placeholderService, geometricFiltersApply, placeholderIdsLookupShouldExecute),
controllers.placeholder(placeholderService, geometricFiltersApply, placeholderIdsLookupShouldExecute),
sanitizers.defer_to_addressit(shouldDeferToAddressIt),
controllers.search(peliasConfig.api, esclient, queries.very_old_prod, oldProdQueryShouldExecute),
controllers.search(peliasConfig.api, esclient, queries.very_old_prod, not(hasRequestErrors)),
controllers.search(peliasConfig.api, esclient, queries.very_old_prod, genitiveQueryShouldExecute, {matchNameToAdmin: true}),
controllers.search(peliasConfig.api, esclient, queries.fuzzy, fuzzyQueryShouldExecute),
postProc.trimByGranularity(),
Expand Down
1 change: 0 additions & 1 deletion sanitizer/_text_addressit.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ function _sanitize( raw, clean ){

// valid input 'text'
else {
clean.parser = 'addressit';
// valid text
clean.text = normalize(raw.text);
if (clean.text && clean.text.length > MAX_RAW_LEN) {
Expand Down

0 comments on commit bca8642

Please sign in to comment.