From 7c58f98ee18636fb723e581416d2babb963bd59d Mon Sep 17 00:00:00 2001 From: Diana Shkolnikov Date: Fri, 21 Apr 2017 09:42:09 -0400 Subject: [PATCH 1/2] add coarse reverse logging so we can tell how often it's getting called --- controller/coarse_reverse.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/controller/coarse_reverse.js b/controller/coarse_reverse.js index d080298c..e8acbf32 100644 --- a/controller/coarse_reverse.js +++ b/controller/coarse_reverse.js @@ -92,6 +92,7 @@ function setup(service, should_execute) { service(centroid, isDNT(req), (err, results) => { // if there's an error, log it and bail if (err) { + logger.info(`[controller:coarse_reverse][error]`); logger.error(err); return next(); } @@ -101,6 +102,8 @@ function setup(service, should_execute) { return req.clean.layers.indexOf(granularity) !== -1; }); + logger.info(`[controller:coarse_reverse][queryType:pip][result_count:${Object.keys(results).length}]`); + // now remove everything from the response that is more granular than the // most granular layer requested. that is, if req.clean.layers=['county'], // remove neighbourhoods, localities, and localadmins From 242d40760d93e8bee8741a92bcb1e1d78731edb4 Mon Sep 17 00:00:00 2001 From: Diana Shkolnikov Date: Fri, 21 Apr 2017 11:40:59 -0400 Subject: [PATCH 2/2] add logging of query input types --- query/search.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/query/search.js b/query/search.js index 91c22299..fcf0b623 100644 --- a/query/search.js +++ b/query/search.js @@ -144,6 +144,9 @@ function generateQuery( clean ){ } function getQuery(vs) { + + logger.info(`[query:search] [search_input_type:${determineQueryType(vs)}]`); + if (hasStreet(vs) || isCityStateOnlyWithOptionalCountry(vs) || isCityCountryOnly(vs) || @@ -160,6 +163,23 @@ function getQuery(vs) { } +function determineQueryType(vs) { + if (vs.isset('input:housenumber') && vs.isset('input:street')) { + return 'address'; + } + else if (vs.isset('input:street')) { + return 'street'; + } + else if (vs.isset('input:query')) { + return 'venue'; + } + else if (['neighbourhood', 'borough', 'postcode', 'county', 'region','country'].some( + (layer)=> { return vs.isset(`input:${layer}`);})) { + return 'admin'; + } + return 'other'; +} + function hasStreet(vs) { return vs.isset('input:street'); }