|
|
@ -28,6 +28,7 @@ var middleware = { |
|
|
|
var controllers = { |
|
|
|
var controllers = { |
|
|
|
coarse_reverse: require('../controller/coarse_reverse'), |
|
|
|
coarse_reverse: require('../controller/coarse_reverse'), |
|
|
|
mdToHTML: require('../controller/markdownToHtml'), |
|
|
|
mdToHTML: require('../controller/markdownToHtml'), |
|
|
|
|
|
|
|
libpostal: require('../controller/libpostal'), |
|
|
|
place: require('../controller/place'), |
|
|
|
place: require('../controller/place'), |
|
|
|
placeholder: require('../controller/placeholder'), |
|
|
|
placeholder: require('../controller/placeholder'), |
|
|
|
search: require('../controller/search'), |
|
|
|
search: require('../controller/search'), |
|
|
@ -116,6 +117,11 @@ function addRoutes(app, peliasConfig) { |
|
|
|
isPipServiceEnabled, not(hasRequestErrors), not(hasResponseData) |
|
|
|
isPipServiceEnabled, not(hasRequestErrors), not(hasResponseData) |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const libpostalShouldExecute = all( |
|
|
|
|
|
|
|
not(hasRequestErrors), |
|
|
|
|
|
|
|
not(isRequestSourcesOnlyWhosOnFirst) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// execute placeholder if libpostal only parsed as admin-only and needs to
|
|
|
|
// execute placeholder if libpostal only parsed as admin-only and needs to
|
|
|
|
// be geodisambiguated
|
|
|
|
// be geodisambiguated
|
|
|
|
const placeholderGeodisambiguationShouldExecute = all( |
|
|
|
const placeholderGeodisambiguationShouldExecute = all( |
|
|
@ -220,6 +226,7 @@ function addRoutes(app, peliasConfig) { |
|
|
|
sanitizers.search.middleware(peliasConfig.api), |
|
|
|
sanitizers.search.middleware(peliasConfig.api), |
|
|
|
middleware.requestLanguage, |
|
|
|
middleware.requestLanguage, |
|
|
|
middleware.calcSize(), |
|
|
|
middleware.calcSize(), |
|
|
|
|
|
|
|
controllers.libpostal(libpostalShouldExecute), |
|
|
|
controllers.placeholder(placeholderService, geometricFiltersApply, placeholderGeodisambiguationShouldExecute), |
|
|
|
controllers.placeholder(placeholderService, geometricFiltersApply, placeholderGeodisambiguationShouldExecute), |
|
|
|
controllers.placeholder(placeholderService, geometricFiltersDontApply, placeholderIdsLookupShouldExecute), |
|
|
|
controllers.placeholder(placeholderService, geometricFiltersDontApply, placeholderIdsLookupShouldExecute), |
|
|
|
controllers.search_with_ids(peliasConfig.api, esclient, queries.address_using_ids, searchWithIdsShouldExecute), |
|
|
|
controllers.search_with_ids(peliasConfig.api, esclient, queries.address_using_ids, searchWithIdsShouldExecute), |
|
|
|