From 45a0755f7d31175c913398763ee47c140778af6b Mon Sep 17 00:00:00 2001 From: Stephen Hess Date: Mon, 15 Aug 2016 09:53:13 -0400 Subject: [PATCH] added 2nd /search query call for fallback to existing behavior while we're refining our process for integrating libpostal, the ES querying behavior will be: - call ES with the fallback/geodisambiguation query - if there are 0 results, call ES with the existing behavior --- routes/v1.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/routes/v1.js b/routes/v1.js index b066cca4..6dc0cdbf 100644 --- a/routes/v1.js +++ b/routes/v1.js @@ -63,7 +63,11 @@ function addRoutes(app, peliasConfig) { search: createRouter([ sanitisers.search.middleware, middleware.calcSize(), + // 2nd parameter is `backend` which gets initialized internally + // 3rd parameter is which query module to use, use fallback/geodisambiguation + // first, then use if first query didn't return anything controllers.search(peliasConfig, undefined, require('../query/search')), + controllers.search(peliasConfig, undefined, require('../query/search_original')), postProc.trimByGranularity(), postProc.distances('focus.point.'), postProc.confidenceScores(peliasConfig),