|
|
|
@ -68,22 +68,22 @@ function addRoutes(app, peliasConfig) {
|
|
|
|
|
|
|
|
|
|
var routers = { |
|
|
|
|
index: createRouter([ |
|
|
|
|
controllers.mdToHTML(peliasConfig, './public/apiDoc.md') |
|
|
|
|
controllers.mdToHTML(peliasConfig.api, './public/apiDoc.md') |
|
|
|
|
]), |
|
|
|
|
attribution: createRouter([ |
|
|
|
|
controllers.mdToHTML(peliasConfig, './public/attribution.md') |
|
|
|
|
controllers.mdToHTML(peliasConfig.api, './public/attribution.md') |
|
|
|
|
]), |
|
|
|
|
search: createRouter([ |
|
|
|
|
sanitizers.search.middleware, |
|
|
|
|
middleware.calcSize(), |
|
|
|
|
// 3rd parameter is which query module to use, use fallback/geodisambiguation
|
|
|
|
|
// first, then use original search strategy if first query didn't return anything
|
|
|
|
|
controllers.search(peliasConfig, esclient, queries.libpostal), |
|
|
|
|
controllers.search(peliasConfig.api, esclient, queries.libpostal), |
|
|
|
|
sanitizers.search_fallback.middleware, |
|
|
|
|
controllers.search(peliasConfig, esclient, queries.fallback_to_old_prod), |
|
|
|
|
controllers.search(peliasConfig.api, esclient, queries.fallback_to_old_prod), |
|
|
|
|
postProc.trimByGranularity(), |
|
|
|
|
postProc.distances('focus.point.'), |
|
|
|
|
postProc.confidenceScores(peliasConfig), |
|
|
|
|
postProc.confidenceScores(peliasConfig.api), |
|
|
|
|
postProc.confidenceScoresFallback(), |
|
|
|
|
postProc.dedupe(), |
|
|
|
|
postProc.accuracy(), |
|
|
|
@ -92,16 +92,16 @@ function addRoutes(app, peliasConfig) {
|
|
|
|
|
postProc.parseBoundingBox(), |
|
|
|
|
postProc.normalizeParentIds(), |
|
|
|
|
postProc.assignLabels(), |
|
|
|
|
postProc.geocodeJSON(peliasConfig, base), |
|
|
|
|
postProc.geocodeJSON(peliasConfig.api, base), |
|
|
|
|
postProc.sendJSON |
|
|
|
|
]), |
|
|
|
|
structured: createRouter([ |
|
|
|
|
sanitizers.structured_geocoding.middleware, |
|
|
|
|
middleware.calcSize(), |
|
|
|
|
controllers.search(peliasConfig, esclient, queries.structured_geocoding), |
|
|
|
|
controllers.search(peliasConfig.api, esclient, queries.structured_geocoding), |
|
|
|
|
postProc.trimByGranularityStructured(), |
|
|
|
|
postProc.distances('focus.point.'), |
|
|
|
|
postProc.confidenceScores(peliasConfig), |
|
|
|
|
postProc.confidenceScores(peliasConfig.api), |
|
|
|
|
postProc.confidenceScoresFallback(), |
|
|
|
|
postProc.dedupe(), |
|
|
|
|
postProc.accuracy(), |
|
|
|
@ -110,14 +110,14 @@ function addRoutes(app, peliasConfig) {
|
|
|
|
|
postProc.parseBoundingBox(), |
|
|
|
|
postProc.normalizeParentIds(), |
|
|
|
|
postProc.assignLabels(), |
|
|
|
|
postProc.geocodeJSON(peliasConfig, base), |
|
|
|
|
postProc.geocodeJSON(peliasConfig.api, base), |
|
|
|
|
postProc.sendJSON |
|
|
|
|
]), |
|
|
|
|
autocomplete: createRouter([ |
|
|
|
|
sanitizers.autocomplete.middleware, |
|
|
|
|
controllers.search(peliasConfig, esclient, queries.autocomplete), |
|
|
|
|
controllers.search(peliasConfig.api, esclient, queries.autocomplete), |
|
|
|
|
postProc.distances('focus.point.'), |
|
|
|
|
postProc.confidenceScores(peliasConfig), |
|
|
|
|
postProc.confidenceScores(peliasConfig.api), |
|
|
|
|
postProc.dedupe(), |
|
|
|
|
postProc.accuracy(), |
|
|
|
|
postProc.localNamingConventions(), |
|
|
|
@ -125,13 +125,13 @@ function addRoutes(app, peliasConfig) {
|
|
|
|
|
postProc.parseBoundingBox(), |
|
|
|
|
postProc.normalizeParentIds(), |
|
|
|
|
postProc.assignLabels(), |
|
|
|
|
postProc.geocodeJSON(peliasConfig, base), |
|
|
|
|
postProc.geocodeJSON(peliasConfig.api, base), |
|
|
|
|
postProc.sendJSON |
|
|
|
|
]), |
|
|
|
|
reverse: createRouter([ |
|
|
|
|
sanitizers.reverse.middleware, |
|
|
|
|
middleware.calcSize(), |
|
|
|
|
controllers.search(peliasConfig, esclient, queries.reverse), |
|
|
|
|
controllers.search(peliasConfig.api, esclient, queries.reverse), |
|
|
|
|
postProc.distances('point.'), |
|
|
|
|
// reverse confidence scoring depends on distance from origin
|
|
|
|
|
// so it must be calculated first
|
|
|
|
@ -143,13 +143,13 @@ function addRoutes(app, peliasConfig) {
|
|
|
|
|
postProc.parseBoundingBox(), |
|
|
|
|
postProc.normalizeParentIds(), |
|
|
|
|
postProc.assignLabels(), |
|
|
|
|
postProc.geocodeJSON(peliasConfig, base), |
|
|
|
|
postProc.geocodeJSON(peliasConfig.api, base), |
|
|
|
|
postProc.sendJSON |
|
|
|
|
]), |
|
|
|
|
nearby: createRouter([ |
|
|
|
|
sanitizers.nearby.middleware, |
|
|
|
|
middleware.calcSize(), |
|
|
|
|
controllers.search(peliasConfig, esclient, queries.reverse), |
|
|
|
|
controllers.search(peliasConfig.api, esclient, queries.reverse), |
|
|
|
|
postProc.distances('point.'), |
|
|
|
|
// reverse confidence scoring depends on distance from origin
|
|
|
|
|
// so it must be calculated first
|
|
|
|
@ -161,19 +161,19 @@ function addRoutes(app, peliasConfig) {
|
|
|
|
|
postProc.parseBoundingBox(), |
|
|
|
|
postProc.normalizeParentIds(), |
|
|
|
|
postProc.assignLabels(), |
|
|
|
|
postProc.geocodeJSON(peliasConfig, base), |
|
|
|
|
postProc.geocodeJSON(peliasConfig.api, base), |
|
|
|
|
postProc.sendJSON |
|
|
|
|
]), |
|
|
|
|
place: createRouter([ |
|
|
|
|
sanitizers.place.middleware, |
|
|
|
|
controllers.place(peliasConfig, esclient), |
|
|
|
|
controllers.place(peliasConfig.api, esclient), |
|
|
|
|
postProc.accuracy(), |
|
|
|
|
postProc.localNamingConventions(), |
|
|
|
|
postProc.renamePlacenames(), |
|
|
|
|
postProc.parseBoundingBox(), |
|
|
|
|
postProc.normalizeParentIds(), |
|
|
|
|
postProc.assignLabels(), |
|
|
|
|
postProc.geocodeJSON(peliasConfig, base), |
|
|
|
|
postProc.geocodeJSON(peliasConfig.api, base), |
|
|
|
|
postProc.sendJSON |
|
|
|
|
]), |
|
|
|
|
status: createRouter([ |
|
|
|
|