Browse Source

added logging in case where query required fallback

pull/666/head
Stephen Hess 8 years ago
parent
commit
165f6eadf1
  1. 6
      sanitiser/search_fallback.js

6
sanitiser/search_fallback.js

@ -4,6 +4,7 @@ var sanitizeAll = require('../sanitiser/sanitizeAll'),
};
var sanitize = function(req, cb) { sanitizeAll(req, sanitizers, cb); };
var logger = require('pelias-logger').get('api:controller:search_fallback');
// middleware
module.exports.middleware = function( req, res, next ){
@ -14,6 +15,11 @@ module.exports.middleware = function( req, res, next ){
return next();
}
// log the query that caused a fallback since libpostal+new-queries didn't return anything
if (req.path === '/v1/search') {
logger.info(req.clean.text);
}
sanitize( req, function( err, clean ){
next();
});

Loading…
Cancel
Save