From 7555095399f882c29034e0cc0c6d341dce9d4fc9 Mon Sep 17 00:00:00 2001 From: Stephen Hess Date: Wed, 19 Oct 2016 13:48:00 -0400 Subject: [PATCH 1/2] added `boost:address` and `boost:street` to search defaults bumped query version to 8.8.0 defaults are `10` and `5`, respectively --- package.json | 2 +- query/search_defaults.js | 5 ++++- test/unit/fixture/search_boundary_country.js | 11 +---------- test/unit/fixture/search_fallback.js | 12 ++---------- test/unit/fixture/search_linguistic_bbox.js | 11 +---------- test/unit/fixture/search_linguistic_focus.js | 11 +---------- test/unit/fixture/search_linguistic_focus_bbox.js | 11 +---------- .../fixture/search_linguistic_focus_null_island.js | 11 +---------- test/unit/fixture/search_linguistic_only.js | 11 +---------- test/unit/fixture/search_linguistic_viewport.js | 11 +---------- .../search_linguistic_viewport_min_diagonal.js | 11 +---------- test/unit/fixture/search_with_category_filtering.js | 11 +---------- test/unit/fixture/search_with_source_filtering.js | 11 +---------- 13 files changed, 17 insertions(+), 112 deletions(-) diff --git a/package.json b/package.json index 85e3e594..0443f632 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "pelias-config": "2.3.0", "pelias-logger": "0.1.0", "pelias-model": "4.3.0", - "pelias-query": "8.7.0", + "pelias-query": "8.8.0", "pelias-text-analyzer": "1.4.0", "stats-lite": "2.0.3", "through2": "2.0.1" diff --git a/query/search_defaults.js b/query/search_defaults.js index 4e6a7ffb..c0d2a6a0 100644 --- a/query/search_defaults.js +++ b/query/search_defaults.js @@ -92,6 +92,9 @@ module.exports = _.merge({}, peliasQuery.defaults, { 'population:field': 'population', 'population:modifier': 'log1p', 'population:max_boost': 20, - 'population:weight': 2 + 'population:weight': 2, + + 'boost:address': 10, + 'boost:street': 5 }); diff --git a/test/unit/fixture/search_boundary_country.js b/test/unit/fixture/search_boundary_country.js index f622e1f5..ba99a72a 100644 --- a/test/unit/fixture/search_boundary_country.js +++ b/test/unit/fixture/search_boundary_country.js @@ -9,6 +9,7 @@ module.exports = { { 'bool': { '_name': 'fallback.street', + 'boost': 5, 'must': [ { 'match_phrase': { @@ -76,16 +77,6 @@ module.exports = { 'size': 50, 'track_scores': true, 'sort': [ - { - 'population': { - 'order': 'desc' - } - }, - { - 'popularity': { - 'order': 'desc' - } - }, '_score' ] }; diff --git a/test/unit/fixture/search_fallback.js b/test/unit/fixture/search_fallback.js index f7983da9..857e47e9 100644 --- a/test/unit/fixture/search_fallback.js +++ b/test/unit/fixture/search_fallback.js @@ -98,6 +98,7 @@ module.exports = { { 'bool': { '_name': 'fallback.address', + 'boost': 10, 'must': [ { 'match_phrase': { @@ -195,6 +196,7 @@ module.exports = { { 'bool': { '_name': 'fallback.street', + 'boost': 5, 'must': [ { 'match_phrase': { @@ -790,16 +792,6 @@ module.exports = { 'size': 20, 'track_scores': true, 'sort': [ - { - 'population': { - 'order': 'desc' - } - }, - { - 'popularity': { - 'order': 'desc' - } - }, '_score' ] }; diff --git a/test/unit/fixture/search_linguistic_bbox.js b/test/unit/fixture/search_linguistic_bbox.js index 52c73c3c..93d2a804 100644 --- a/test/unit/fixture/search_linguistic_bbox.js +++ b/test/unit/fixture/search_linguistic_bbox.js @@ -9,6 +9,7 @@ module.exports = { { 'bool': { '_name': 'fallback.street', + 'boost': 5, 'must': [ { 'match_phrase': { @@ -79,16 +80,6 @@ module.exports = { 'size': 50, 'track_scores': true, 'sort': [ - { - 'population': { - 'order': 'desc' - } - }, - { - 'popularity': { - 'order': 'desc' - } - }, '_score' ] }; diff --git a/test/unit/fixture/search_linguistic_focus.js b/test/unit/fixture/search_linguistic_focus.js index 33c62c1e..aeda6ba2 100644 --- a/test/unit/fixture/search_linguistic_focus.js +++ b/test/unit/fixture/search_linguistic_focus.js @@ -9,6 +9,7 @@ module.exports = { { 'bool': { '_name': 'fallback.street', + 'boost': 5, 'must': [ { 'match_phrase': { @@ -82,16 +83,6 @@ module.exports = { 'size': 50, 'track_scores': true, 'sort': [ - { - 'population': { - 'order': 'desc' - } - }, - { - 'popularity': { - 'order': 'desc' - } - }, '_score' ] }; diff --git a/test/unit/fixture/search_linguistic_focus_bbox.js b/test/unit/fixture/search_linguistic_focus_bbox.js index 717c27ac..335c9ad3 100644 --- a/test/unit/fixture/search_linguistic_focus_bbox.js +++ b/test/unit/fixture/search_linguistic_focus_bbox.js @@ -9,6 +9,7 @@ module.exports = { { 'bool': { '_name': 'fallback.street', + 'boost': 5, 'must': [ { 'match_phrase': { @@ -93,16 +94,6 @@ module.exports = { 'size': 50, 'track_scores': true, 'sort': [ - { - 'population': { - 'order': 'desc' - } - }, - { - 'popularity': { - 'order': 'desc' - } - }, '_score' ] }; diff --git a/test/unit/fixture/search_linguistic_focus_null_island.js b/test/unit/fixture/search_linguistic_focus_null_island.js index 20f72ceb..e1416526 100644 --- a/test/unit/fixture/search_linguistic_focus_null_island.js +++ b/test/unit/fixture/search_linguistic_focus_null_island.js @@ -9,6 +9,7 @@ module.exports = { { 'bool': { '_name': 'fallback.street', + 'boost': 5, 'must': [ { 'match_phrase': { @@ -82,16 +83,6 @@ module.exports = { 'size': 50, 'track_scores': true, 'sort': [ - { - 'population': { - 'order': 'desc' - } - }, - { - 'popularity': { - 'order': 'desc' - } - }, '_score' ] }; diff --git a/test/unit/fixture/search_linguistic_only.js b/test/unit/fixture/search_linguistic_only.js index 8c377f71..1f1479a3 100644 --- a/test/unit/fixture/search_linguistic_only.js +++ b/test/unit/fixture/search_linguistic_only.js @@ -9,6 +9,7 @@ module.exports = { { 'bool': { '_name': 'fallback.street', + 'boost': 5, 'must': [ { 'match_phrase': { @@ -68,16 +69,6 @@ module.exports = { 'size': 50, 'track_scores': true, 'sort': [ - { - 'population': { - 'order': 'desc' - } - }, - { - 'popularity': { - 'order': 'desc' - } - }, '_score' ] }; diff --git a/test/unit/fixture/search_linguistic_viewport.js b/test/unit/fixture/search_linguistic_viewport.js index 8c377f71..1f1479a3 100644 --- a/test/unit/fixture/search_linguistic_viewport.js +++ b/test/unit/fixture/search_linguistic_viewport.js @@ -9,6 +9,7 @@ module.exports = { { 'bool': { '_name': 'fallback.street', + 'boost': 5, 'must': [ { 'match_phrase': { @@ -68,16 +69,6 @@ module.exports = { 'size': 50, 'track_scores': true, 'sort': [ - { - 'population': { - 'order': 'desc' - } - }, - { - 'popularity': { - 'order': 'desc' - } - }, '_score' ] }; diff --git a/test/unit/fixture/search_linguistic_viewport_min_diagonal.js b/test/unit/fixture/search_linguistic_viewport_min_diagonal.js index 8c377f71..1f1479a3 100644 --- a/test/unit/fixture/search_linguistic_viewport_min_diagonal.js +++ b/test/unit/fixture/search_linguistic_viewport_min_diagonal.js @@ -9,6 +9,7 @@ module.exports = { { 'bool': { '_name': 'fallback.street', + 'boost': 5, 'must': [ { 'match_phrase': { @@ -68,16 +69,6 @@ module.exports = { 'size': 50, 'track_scores': true, 'sort': [ - { - 'population': { - 'order': 'desc' - } - }, - { - 'popularity': { - 'order': 'desc' - } - }, '_score' ] }; diff --git a/test/unit/fixture/search_with_category_filtering.js b/test/unit/fixture/search_with_category_filtering.js index 9913b19c..05f9ec4e 100644 --- a/test/unit/fixture/search_with_category_filtering.js +++ b/test/unit/fixture/search_with_category_filtering.js @@ -9,6 +9,7 @@ module.exports = { { 'bool': { '_name': 'fallback.street', + 'boost': 5, 'must': [ { 'match_phrase': { @@ -69,16 +70,6 @@ module.exports = { 'size': 20, 'track_scores': true, 'sort': [ - { - 'population': { - 'order': 'desc' - } - }, - { - 'popularity': { - 'order': 'desc' - } - }, '_score' ] }; diff --git a/test/unit/fixture/search_with_source_filtering.js b/test/unit/fixture/search_with_source_filtering.js index 78889325..0e9010c2 100644 --- a/test/unit/fixture/search_with_source_filtering.js +++ b/test/unit/fixture/search_with_source_filtering.js @@ -9,6 +9,7 @@ module.exports = { { 'bool': { '_name': 'fallback.street', + 'boost': 5, 'must': [ { 'match_phrase': { @@ -68,16 +69,6 @@ module.exports = { 'size': 20, 'track_scores': true, 'sort': [ - { - 'population': { - 'order': 'desc' - } - }, - { - 'popularity': { - 'order': 'desc' - } - }, '_score' ] }; From 4dbaff6589d153525803e8387274269265336866 Mon Sep 17 00:00:00 2001 From: Stephen Hess Date: Wed, 19 Oct 2016 14:24:34 -0400 Subject: [PATCH 2/2] removed hard-coded `size` effectively reverts https://github.com/pelias/api/pull/684 --- query/search.js | 2 +- test/unit/fixture/search_boundary_country.js | 2 +- test/unit/fixture/search_linguistic_bbox.js | 2 +- test/unit/fixture/search_linguistic_focus.js | 2 +- test/unit/fixture/search_linguistic_focus_bbox.js | 2 +- test/unit/fixture/search_linguistic_focus_null_island.js | 2 +- test/unit/fixture/search_linguistic_only.js | 2 +- test/unit/fixture/search_linguistic_viewport.js | 2 +- test/unit/fixture/search_linguistic_viewport_min_diagonal.js | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/query/search.js b/query/search.js index 29dea8b9..bed5a63c 100644 --- a/query/search.js +++ b/query/search.js @@ -59,7 +59,7 @@ function generateQuery( clean ){ // size if( clean.querySize ) { - vs.var( 'size', 50 ); + vs.var( 'size', clean.querySize ); } // focus point diff --git a/test/unit/fixture/search_boundary_country.js b/test/unit/fixture/search_boundary_country.js index ba99a72a..ee6427a0 100644 --- a/test/unit/fixture/search_boundary_country.js +++ b/test/unit/fixture/search_boundary_country.js @@ -74,7 +74,7 @@ module.exports = { 'boost_mode': 'multiply' } }, - 'size': 50, + 'size': 10, 'track_scores': true, 'sort': [ '_score' diff --git a/test/unit/fixture/search_linguistic_bbox.js b/test/unit/fixture/search_linguistic_bbox.js index 93d2a804..e74f6c79 100644 --- a/test/unit/fixture/search_linguistic_bbox.js +++ b/test/unit/fixture/search_linguistic_bbox.js @@ -77,7 +77,7 @@ module.exports = { 'boost_mode': 'multiply' } }, - 'size': 50, + 'size': 10, 'track_scores': true, 'sort': [ '_score' diff --git a/test/unit/fixture/search_linguistic_focus.js b/test/unit/fixture/search_linguistic_focus.js index aeda6ba2..a63400b3 100644 --- a/test/unit/fixture/search_linguistic_focus.js +++ b/test/unit/fixture/search_linguistic_focus.js @@ -80,7 +80,7 @@ module.exports = { 'boost_mode': 'multiply' } }, - 'size': 50, + 'size': 10, 'track_scores': true, 'sort': [ '_score' diff --git a/test/unit/fixture/search_linguistic_focus_bbox.js b/test/unit/fixture/search_linguistic_focus_bbox.js index 335c9ad3..7f6c8528 100644 --- a/test/unit/fixture/search_linguistic_focus_bbox.js +++ b/test/unit/fixture/search_linguistic_focus_bbox.js @@ -91,7 +91,7 @@ module.exports = { 'boost_mode': 'multiply' } }, - 'size': 50, + 'size': 10, 'track_scores': true, 'sort': [ '_score' diff --git a/test/unit/fixture/search_linguistic_focus_null_island.js b/test/unit/fixture/search_linguistic_focus_null_island.js index e1416526..da12154a 100644 --- a/test/unit/fixture/search_linguistic_focus_null_island.js +++ b/test/unit/fixture/search_linguistic_focus_null_island.js @@ -80,7 +80,7 @@ module.exports = { 'boost_mode': 'multiply' } }, - 'size': 50, + 'size': 10, 'track_scores': true, 'sort': [ '_score' diff --git a/test/unit/fixture/search_linguistic_only.js b/test/unit/fixture/search_linguistic_only.js index 1f1479a3..0117e03b 100644 --- a/test/unit/fixture/search_linguistic_only.js +++ b/test/unit/fixture/search_linguistic_only.js @@ -66,7 +66,7 @@ module.exports = { 'boost_mode': 'multiply' } }, - 'size': 50, + 'size': 10, 'track_scores': true, 'sort': [ '_score' diff --git a/test/unit/fixture/search_linguistic_viewport.js b/test/unit/fixture/search_linguistic_viewport.js index 1f1479a3..0117e03b 100644 --- a/test/unit/fixture/search_linguistic_viewport.js +++ b/test/unit/fixture/search_linguistic_viewport.js @@ -66,7 +66,7 @@ module.exports = { 'boost_mode': 'multiply' } }, - 'size': 50, + 'size': 10, 'track_scores': true, 'sort': [ '_score' diff --git a/test/unit/fixture/search_linguistic_viewport_min_diagonal.js b/test/unit/fixture/search_linguistic_viewport_min_diagonal.js index 1f1479a3..0117e03b 100644 --- a/test/unit/fixture/search_linguistic_viewport_min_diagonal.js +++ b/test/unit/fixture/search_linguistic_viewport_min_diagonal.js @@ -66,7 +66,7 @@ module.exports = { 'boost_mode': 'multiply' } }, - 'size': 50, + 'size': 10, 'track_scores': true, 'sort': [ '_score'