From 17a28d881d725b52a3178d88e5c8860c085573db Mon Sep 17 00:00:00 2001 From: greenkeeperio-bot Date: Thu, 20 Apr 2017 17:20:57 -0400 Subject: [PATCH 1/5] chore(package): update pelias-model to version 4.8.0 https://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bb4b6c28..d7cb5989 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "pelias-labels": "1.6.0", "pelias-logger": "0.2.0", "pelias-mock-logger": "^1.0.1", - "pelias-model": "4.6.0", + "pelias-model": "4.8.0", "pelias-query": "8.15.0", "pelias-text-analyzer": "1.8.0", "predicates": "^1.0.1", From 75f44f99328415014bea6a48ad87cf41bd48c46d Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Thu, 27 Apr 2017 17:59:08 +0000 Subject: [PATCH 2/5] fix(package): update addressit to version 1.5.0 https://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d7cb5989..aed9dc6e 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "node": ">=4.0.0" }, "dependencies": { - "addressit": "1.4.0", + "addressit": "1.5.0", "async": "^2.0.0", "check-types": "^7.0.0", "elasticsearch": "^12.0.1", From 6b0b124d8f2a1cf08263be32a244f0e90697da3c Mon Sep 17 00:00:00 2001 From: Julian Simioni Date: Fri, 28 Apr 2017 12:13:25 -0400 Subject: [PATCH 3/5] Always query for a minimum of 20 results from Elasticsearch Fallback and interpolation queries rely on several results coming back from Elasticsearch to ensure the best result is returned. It was possible that queries with `size=1` would not return enough results from Elasticsearch. This change ensures even with `size=1` a sufficient number of results are returned. Fixes https://github.com/pelias/pelias/issues/562 --- middleware/sizeCalculator.js | 11 ++++------- test/unit/helper/sizeCalculator.js | 12 ++++++++++-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/middleware/sizeCalculator.js b/middleware/sizeCalculator.js index 88334d3b..69409e45 100644 --- a/middleware/sizeCalculator.js +++ b/middleware/sizeCalculator.js @@ -2,6 +2,8 @@ var _ = require('lodash'); var SIZE_PADDING = 2; +var MIN_QUERY_SIZE = 20; + /** * Utility for calculating query result size * incorporating padding for dedupe process @@ -24,12 +26,7 @@ function setup() { * @returns {number} */ function calculateSize(cleanSize) { - switch (cleanSize || 1) { - case 1: - return 1; - default: - return cleanSize * SIZE_PADDING; - } + return Math.max(MIN_QUERY_SIZE, cleanSize * SIZE_PADDING); } -module.exports = setup; \ No newline at end of file +module.exports = setup; diff --git a/test/unit/helper/sizeCalculator.js b/test/unit/helper/sizeCalculator.js index 41d854d4..6c8d8d22 100644 --- a/test/unit/helper/sizeCalculator.js +++ b/test/unit/helper/sizeCalculator.js @@ -25,7 +25,7 @@ module.exports.tests.valid = function(test, common) { test('size=0', function (t) { setup(0); calcSize(req, {}, function () { - t.equal(req.clean.querySize, 1); + t.equal(req.clean.querySize, 20); t.end(); }); }); @@ -33,7 +33,7 @@ module.exports.tests.valid = function(test, common) { test('size=1', function (t) { setup(1); calcSize(req, {}, function () { - t.equal(req.clean.querySize, 1); + t.equal(req.clean.querySize, 20); t.end(); }); }); @@ -46,6 +46,14 @@ module.exports.tests.valid = function(test, common) { }); }); + test('size=20', function (t) { + setup(20); + calcSize(req, {}, function () { + t.equal(req.clean.querySize, 40); + t.end(); + }); + }); + test('no size', function (t) { setup(); calcSize(req, {}, function () { From af2a888186eb704151f4275c865317f042e8363a Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Wed, 3 May 2017 20:57:04 +0000 Subject: [PATCH 4/5] fix(package): update pelias-config to version 2.10.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d7cb5989..4f2fd810 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "lodash": "^4.5.0", "markdown": "0.5.0", "morgan": "1.8.1", - "pelias-config": "2.9.0", + "pelias-config": "2.10.0", "pelias-categories": "1.2.0", "pelias-labels": "1.6.0", "pelias-logger": "0.2.0", From 387ecd656b5fc9eeb6a33182cba3897b4402d692 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Fri, 5 May 2017 17:44:17 +0000 Subject: [PATCH 5/5] fix(package): update pelias-text-analyzer to version 1.8.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index aed9dc6e..f608861a 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "pelias-mock-logger": "^1.0.1", "pelias-model": "4.8.0", "pelias-query": "8.15.0", - "pelias-text-analyzer": "1.8.0", + "pelias-text-analyzer": "1.8.1", "predicates": "^1.0.1", "retry": "^0.10.1", "request": "^2.79.0",