diff --git a/middleware/sizeCalculator.js b/middleware/sizeCalculator.js index f8c6936c..9b577916 100644 --- a/middleware/sizeCalculator.js +++ b/middleware/sizeCalculator.js @@ -9,6 +9,10 @@ var MIN_QUERY_SIZE = 20; * incorporating padding for dedupe process */ function setup(min_size) { + if (min_size === undefined) { + min_size = MIN_QUERY_SIZE; + } + return function setQuerySize(req, res, next) { if (_.isUndefined(req.clean) || _.isUndefined(req.clean.size)) { return next(); @@ -25,8 +29,8 @@ function setup(min_size) { * @param {number} cleanSize * @returns {number} */ -function calculateSize(cleanSize) { - return Math.max(MIN_QUERY_SIZE, cleanSize * SIZE_PADDING); +function calculateSize(cleanSize, min_size) { + return Math.max(min_size, cleanSize * SIZE_PADDING); } module.exports = setup;