From cb679888ff741b1ef6cb32208ea3f3efe34e0696 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Wed, 7 Oct 2015 19:56:39 +0200 Subject: [PATCH 1/4] better population and popularity boosting --- package.json | 2 +- query/autocomplete.js | 3 +- query/defaults.js | 16 ++++- query/reverse.js | 2 +- query/search.js | 3 +- .../fixture/autocomplete_linguistic_focus.js | 68 ++++++++++++------- ...tocomplete_linguistic_focus_null_island.js | 66 +++++++++++------- .../fixture/autocomplete_linguistic_only.js | 68 ++++++++++++------- test/unit/fixture/search_boundary_country.js | 66 +++++++++++------- test/unit/fixture/search_full_address.js | 65 +++++++++++------- test/unit/fixture/search_linguistic_bbox.js | 68 ++++++++++++------- test/unit/fixture/search_linguistic_focus.js | 68 ++++++++++++------- .../fixture/search_linguistic_focus_bbox.js | 68 ++++++++++++------- .../search_linguistic_focus_null_island.js | 66 +++++++++++------- test/unit/fixture/search_linguistic_only.js | 68 ++++++++++++------- test/unit/fixture/search_partial_address.js | 68 ++++++++++++------- test/unit/fixture/search_regions_address.js | 68 ++++++++++++------- 17 files changed, 519 insertions(+), 314 deletions(-) diff --git a/package.json b/package.json index abca960e..9cf371b9 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "pelias-config": "^1.0.1", "pelias-esclient": "0.0.25", "pelias-logger": "^0.0.8", - "pelias-query": "2.0.0", + "pelias-query": "4.0.0", "pelias-schema": "1.0.0", "pelias-suggester-pipeline": "2.0.2", "stats-lite": "^1.0.3", diff --git a/query/autocomplete.js b/query/autocomplete.js index 62fb775e..ad64413a 100644 --- a/query/autocomplete.js +++ b/query/autocomplete.js @@ -14,7 +14,8 @@ query.score( peliasQuery.view.ngrams, 'must' ); // scoring boost query.score( peliasQuery.view.phrase ); query.score( peliasQuery.view.focus( peliasQuery.view.ngrams ) ); -query.score( peliasQuery.view.popularity(['admin0','admin1','admin2']) ); +query.score( peliasQuery.view.popularity( peliasQuery.view.phrase ) ); +query.score( peliasQuery.view.population( peliasQuery.view.phrase ) ); // -------------------------------- diff --git a/query/defaults.js b/query/defaults.js index 83ddb4d9..7b761ae6 100644 --- a/query/defaults.js +++ b/query/defaults.js @@ -8,7 +8,7 @@ module.exports = extend( false, peliasQuery.defaults, { 'track_scores': true, 'centroid:field': 'center_point', - + 'sort:distance:order': 'asc', 'sort:distance:distance_type': 'plane', @@ -79,6 +79,16 @@ module.exports = extend( false, peliasQuery.defaults, { 'admin:neighborhood:analyzer': 'peliasAdmin', 'admin:neighborhood:field': 'neighborhood', - 'admin:neighborhood:boost': 1 + 'admin:neighborhood:boost': 1, + + 'popularity:field': 'popularity', + 'popularity:modifier': 'sqrt', + 'popularity:max_boost': 10000, + 'popularity:weight': 1, + + 'population:field': 'population', + 'population:modifier': 'sqrt', + 'population:max_boost': 2000, + 'population:weight': 1 -}); \ No newline at end of file +}); diff --git a/query/reverse.js b/query/reverse.js index 9401f916..fd84b427 100644 --- a/query/reverse.js +++ b/query/reverse.js @@ -44,7 +44,7 @@ function generateQuery( clean ){ // bounding circle // note: the sanitizers will take care of the case - // where point.lan/point.lon are provided in the + // where point.lan/point.lon are provided in the // absense of boundary.circle.lat/boundary.circle.lon if( check.number(clean['boundary.circle.lat']) && check.number(clean['boundary.circle.lon']) && diff --git a/query/search.js b/query/search.js index a3787535..3eeb8798 100644 --- a/query/search.js +++ b/query/search.js @@ -15,7 +15,8 @@ query.score( peliasQuery.view.ngrams, 'must' ); // scoring boost query.score( peliasQuery.view.phrase ); query.score( peliasQuery.view.focus( peliasQuery.view.phrase ) ); -query.score( peliasQuery.view.popularity(['admin0','admin1','admin2']) ); +query.score( peliasQuery.view.popularity( peliasQuery.view.phrase ) ); +query.score( peliasQuery.view.population( peliasQuery.view.phrase ) ); // address components query.score( peliasQuery.view.address('housenumber') ); diff --git a/test/unit/fixture/autocomplete_linguistic_focus.js b/test/unit/fixture/autocomplete_linguistic_focus.js index 2049bf0b..31404731 100644 --- a/test/unit/fixture/autocomplete_linguistic_focus.js +++ b/test/unit/fixture/autocomplete_linguistic_focus.js @@ -50,39 +50,26 @@ module.exports = { 'score_mode': 'avg', 'boost_mode': 'replace' } - }, - { + },{ 'function_score': { 'query': { - 'filtered': { - 'filter': { - 'exists': { - 'field': 'popularity' - } + 'match': { + 'phrase.default': { + 'query': 'test', + 'analyzer': 'peliasPhrase', + 'type': 'phrase', + 'slop': 2, + 'boost': 1 } } }, - 'max_boost': 2, + 'max_boost': 10000, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { - 'or': [ - { - 'type': { - 'value': 'admin0' - } - }, - { - 'type': { - 'value': 'admin1' - } - }, - { - 'type': { - 'value': 'admin2' - } - } - ] + 'exists': { + 'field': 'popularity' + } }, 'functions': [{ 'field_value_factor': { @@ -92,6 +79,35 @@ module.exports = { 'weight': 1 }] } + },{ + 'function_score': { + 'query': { + 'match': { + 'phrase.default': { + 'query': 'test', + 'analyzer': 'peliasPhrase', + 'type': 'phrase', + 'slop': 2, + 'boost': 1 + } + } + }, + 'max_boost': 2000, + 'score_mode': 'first', + 'boost_mode': 'replace', + 'filter': { + 'exists': { + 'field': 'population' + } + }, + 'functions': [{ + 'field_value_factor': { + 'modifier': 'sqrt', + 'field': 'population' + }, + 'weight': 1 + }] + } }] } } @@ -100,4 +116,4 @@ module.exports = { 'sort': [ '_score' ], 'size': 10, 'track_scores': true -}; \ No newline at end of file +}; diff --git a/test/unit/fixture/autocomplete_linguistic_focus_null_island.js b/test/unit/fixture/autocomplete_linguistic_focus_null_island.js index 57d4747c..2f46b9b0 100644 --- a/test/unit/fixture/autocomplete_linguistic_focus_null_island.js +++ b/test/unit/fixture/autocomplete_linguistic_focus_null_island.js @@ -50,39 +50,26 @@ module.exports = { 'score_mode': 'avg', 'boost_mode': 'replace' } - }, - { + },{ 'function_score': { 'query': { - 'filtered': { - 'filter': { - 'exists': { - 'field': 'popularity' - } + 'match': { + 'phrase.default': { + 'query': 'test', + 'analyzer': 'peliasPhrase', + 'type': 'phrase', + 'slop': 2, + 'boost': 1 } } }, - 'max_boost': 2, + 'max_boost': 10000, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { - 'or': [ - { - 'type': { - 'value': 'admin0' - } - }, - { - 'type': { - 'value': 'admin1' - } - }, - { - 'type': { - 'value': 'admin2' - } - } - ] + 'exists': { + 'field': 'popularity' + } }, 'functions': [{ 'field_value_factor': { @@ -92,6 +79,35 @@ module.exports = { 'weight': 1 }] } + },{ + 'function_score': { + 'query': { + 'match': { + 'phrase.default': { + 'query': 'test', + 'analyzer': 'peliasPhrase', + 'type': 'phrase', + 'slop': 2, + 'boost': 1 + } + } + }, + 'max_boost': 2000, + 'score_mode': 'first', + 'boost_mode': 'replace', + 'filter': { + 'exists': { + 'field': 'population' + } + }, + 'functions': [{ + 'field_value_factor': { + 'modifier': 'sqrt', + 'field': 'population' + }, + 'weight': 1 + }] + } }] } } diff --git a/test/unit/fixture/autocomplete_linguistic_only.js b/test/unit/fixture/autocomplete_linguistic_only.js index ac059ef1..65db3fc8 100644 --- a/test/unit/fixture/autocomplete_linguistic_only.js +++ b/test/unit/fixture/autocomplete_linguistic_only.js @@ -23,39 +23,26 @@ module.exports = { 'slop': 2 } } - }, - { + },{ 'function_score': { 'query': { - 'filtered': { - 'filter': { - 'exists': { - 'field': 'popularity' - } + 'match': { + 'phrase.default': { + 'query': 'test', + 'analyzer': 'peliasPhrase', + 'type': 'phrase', + 'slop': 2, + 'boost': 1 } } }, - 'max_boost': 2, + 'max_boost': 10000, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { - 'or': [ - { - 'type': { - 'value': 'admin0' - } - }, - { - 'type': { - 'value': 'admin1' - } - }, - { - 'type': { - 'value': 'admin2' - } - } - ] + 'exists': { + 'field': 'popularity' + } }, 'functions': [{ 'field_value_factor': { @@ -65,6 +52,35 @@ module.exports = { 'weight': 1 }] } + },{ + 'function_score': { + 'query': { + 'match': { + 'phrase.default': { + 'query': 'test', + 'analyzer': 'peliasPhrase', + 'type': 'phrase', + 'slop': 2, + 'boost': 1 + } + } + }, + 'max_boost': 2000, + 'score_mode': 'first', + 'boost_mode': 'replace', + 'filter': { + 'exists': { + 'field': 'population' + } + }, + 'functions': [{ + 'field_value_factor': { + 'modifier': 'sqrt', + 'field': 'population' + }, + 'weight': 1 + }] + } }] } } @@ -73,4 +89,4 @@ module.exports = { 'sort': [ '_score' ], 'size': 10, 'track_scores': true -}; \ No newline at end of file +}; diff --git a/test/unit/fixture/search_boundary_country.js b/test/unit/fixture/search_boundary_country.js index a75a8091..76f2c44c 100644 --- a/test/unit/fixture/search_boundary_country.js +++ b/test/unit/fixture/search_boundary_country.js @@ -33,39 +33,26 @@ module.exports = { 'slop': 2 } } - }, - { + },{ 'function_score': { 'query': { - 'filtered': { - 'filter': { - 'exists': { - 'field': 'popularity' - } + 'match': { + 'phrase.default': { + 'query': 'test', + 'analyzer': 'peliasPhrase', + 'type': 'phrase', + 'slop': 2, + 'boost': 1 } } }, - 'max_boost': 2, + 'max_boost': 10000, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { - 'or': [ - { - 'type': { - 'value': 'admin0' - } - }, - { - 'type': { - 'value': 'admin1' - } - }, - { - 'type': { - 'value': 'admin2' - } - } - ] + 'exists': { + 'field': 'popularity' + } }, 'functions': [{ 'field_value_factor': { @@ -75,6 +62,35 @@ module.exports = { 'weight': 1 }] } + },{ + 'function_score': { + 'query': { + 'match': { + 'phrase.default': { + 'query': 'test', + 'analyzer': 'peliasPhrase', + 'type': 'phrase', + 'slop': 2, + 'boost': 1 + } + } + }, + 'max_boost': 2000, + 'score_mode': 'first', + 'boost_mode': 'replace', + 'filter': { + 'exists': { + 'field': 'population' + } + }, + 'functions': [{ + 'field_value_factor': { + 'modifier': 'sqrt', + 'field': 'population' + }, + 'weight': 1 + }] + } }] } } diff --git a/test/unit/fixture/search_full_address.js b/test/unit/fixture/search_full_address.js index aff242b8..0abf05b1 100644 --- a/test/unit/fixture/search_full_address.js +++ b/test/unit/fixture/search_full_address.js @@ -30,35 +30,23 @@ module.exports = { { 'function_score': { 'query': { - 'filtered': { - 'filter': { - 'exists': { - 'field': 'popularity' - } + 'match': { + 'phrase.default': { + 'query': '123 main st', + 'analyzer': 'peliasPhrase', + 'type': 'phrase', + 'slop': 2, + 'boost': 1 } } }, - 'max_boost': 2, + 'max_boost': 10000, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { - 'or': [ - { - 'type': { - 'value': 'admin0' - } - }, - { - 'type': { - 'value': 'admin1' - } - }, - { - 'type': { - 'value': 'admin2' - } - } - ] + 'exists': { + 'field': 'popularity' + } }, 'functions': [{ 'field_value_factor': { @@ -68,6 +56,35 @@ module.exports = { 'weight': 1 }] } + },{ + 'function_score': { + 'query': { + 'match': { + 'phrase.default': { + 'query': '123 main st', + 'analyzer': 'peliasPhrase', + 'type': 'phrase', + 'slop': 2, + 'boost': 1 + } + } + }, + 'max_boost': 2000, + 'score_mode': 'first', + 'boost_mode': 'replace', + 'filter': { + 'exists': { + 'field': 'population' + } + }, + 'functions': [{ + 'field_value_factor': { + 'modifier': 'sqrt', + 'field': 'population' + }, + 'weight': 1 + }] + } },{ 'match': { 'address.number': { @@ -164,4 +181,4 @@ module.exports = { 'size': 10, 'sort': [ '_score' ], 'track_scores': true -}; \ No newline at end of file +}; diff --git a/test/unit/fixture/search_linguistic_bbox.js b/test/unit/fixture/search_linguistic_bbox.js index 6c98b010..738d1b83 100644 --- a/test/unit/fixture/search_linguistic_bbox.js +++ b/test/unit/fixture/search_linguistic_bbox.js @@ -23,39 +23,26 @@ module.exports = { 'slop': 2 } } - }, - { + },{ 'function_score': { 'query': { - 'filtered': { - 'filter': { - 'exists': { - 'field': 'popularity' - } + 'match': { + 'phrase.default': { + 'query': 'test', + 'analyzer': 'peliasPhrase', + 'type': 'phrase', + 'slop': 2, + 'boost': 1 } } }, - 'max_boost': 2, + 'max_boost': 10000, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { - 'or': [ - { - 'type': { - 'value': 'admin0' - } - }, - { - 'type': { - 'value': 'admin1' - } - }, - { - 'type': { - 'value': 'admin2' - } - } - ] + 'exists': { + 'field': 'popularity' + } }, 'functions': [{ 'field_value_factor': { @@ -65,6 +52,35 @@ module.exports = { 'weight': 1 }] } + },{ + 'function_score': { + 'query': { + 'match': { + 'phrase.default': { + 'query': 'test', + 'analyzer': 'peliasPhrase', + 'type': 'phrase', + 'slop': 2, + 'boost': 1 + } + } + }, + 'max_boost': 2000, + 'score_mode': 'first', + 'boost_mode': 'replace', + 'filter': { + 'exists': { + 'field': 'population' + } + }, + 'functions': [{ + 'field_value_factor': { + 'modifier': 'sqrt', + 'field': 'population' + }, + 'weight': 1 + }] + } }] } }, @@ -89,4 +105,4 @@ module.exports = { 'sort': [ '_sort' ], 'size': 10, 'track_scores': true -}; \ No newline at end of file +}; diff --git a/test/unit/fixture/search_linguistic_focus.js b/test/unit/fixture/search_linguistic_focus.js index 072bca64..c20ddbf9 100644 --- a/test/unit/fixture/search_linguistic_focus.js +++ b/test/unit/fixture/search_linguistic_focus.js @@ -52,39 +52,26 @@ module.exports = { 'score_mode': 'avg', 'boost_mode': 'replace' } - }, - { + },{ 'function_score': { 'query': { - 'filtered': { - 'filter': { - 'exists': { - 'field': 'popularity' - } + 'match': { + 'phrase.default': { + 'query': 'test', + 'analyzer': 'peliasPhrase', + 'type': 'phrase', + 'slop': 2, + 'boost': 1 } } }, - 'max_boost': 2, + 'max_boost': 10000, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { - 'or': [ - { - 'type': { - 'value': 'admin0' - } - }, - { - 'type': { - 'value': 'admin1' - } - }, - { - 'type': { - 'value': 'admin2' - } - } - ] + 'exists': { + 'field': 'popularity' + } }, 'functions': [{ 'field_value_factor': { @@ -94,6 +81,35 @@ module.exports = { 'weight': 1 }] } + },{ + 'function_score': { + 'query': { + 'match': { + 'phrase.default': { + 'query': 'test', + 'analyzer': 'peliasPhrase', + 'type': 'phrase', + 'slop': 2, + 'boost': 1 + } + } + }, + 'max_boost': 2000, + 'score_mode': 'first', + 'boost_mode': 'replace', + 'filter': { + 'exists': { + 'field': 'population' + } + }, + 'functions': [{ + 'field_value_factor': { + 'modifier': 'sqrt', + 'field': 'population' + }, + 'weight': 1 + }] + } }] } } @@ -102,4 +118,4 @@ module.exports = { 'sort': [ '_sort' ], 'size': 10, 'track_scores': true -}; \ No newline at end of file +}; diff --git a/test/unit/fixture/search_linguistic_focus_bbox.js b/test/unit/fixture/search_linguistic_focus_bbox.js index e6a04824..92301fa6 100644 --- a/test/unit/fixture/search_linguistic_focus_bbox.js +++ b/test/unit/fixture/search_linguistic_focus_bbox.js @@ -52,39 +52,26 @@ module.exports = { 'score_mode': 'avg', 'boost_mode': 'replace' } - }, - { + },{ 'function_score': { 'query': { - 'filtered': { - 'filter': { - 'exists': { - 'field': 'popularity' - } + 'match': { + 'phrase.default': { + 'query': 'test', + 'analyzer': 'peliasPhrase', + 'type': 'phrase', + 'slop': 2, + 'boost': 1 } } }, - 'max_boost': 2, + 'max_boost': 10000, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { - 'or': [ - { - 'type': { - 'value': 'admin0' - } - }, - { - 'type': { - 'value': 'admin1' - } - }, - { - 'type': { - 'value': 'admin2' - } - } - ] + 'exists': { + 'field': 'popularity' + } }, 'functions': [{ 'field_value_factor': { @@ -94,6 +81,35 @@ module.exports = { 'weight': 1 }] } + },{ + 'function_score': { + 'query': { + 'match': { + 'phrase.default': { + 'query': 'test', + 'analyzer': 'peliasPhrase', + 'type': 'phrase', + 'slop': 2, + 'boost': 1 + } + } + }, + 'max_boost': 2000, + 'score_mode': 'first', + 'boost_mode': 'replace', + 'filter': { + 'exists': { + 'field': 'population' + } + }, + 'functions': [{ + 'field_value_factor': { + 'modifier': 'sqrt', + 'field': 'population' + }, + 'weight': 1 + }] + } }] } }, @@ -118,4 +134,4 @@ module.exports = { 'sort': [ '_sort' ], 'size': 10, 'track_scores': true -}; \ No newline at end of file +}; diff --git a/test/unit/fixture/search_linguistic_focus_null_island.js b/test/unit/fixture/search_linguistic_focus_null_island.js index 832aa9f7..85e6d40a 100644 --- a/test/unit/fixture/search_linguistic_focus_null_island.js +++ b/test/unit/fixture/search_linguistic_focus_null_island.js @@ -52,39 +52,26 @@ module.exports = { 'score_mode': 'avg', 'boost_mode': 'replace' } - }, - { + },{ 'function_score': { 'query': { - 'filtered': { - 'filter': { - 'exists': { - 'field': 'popularity' - } + 'match': { + 'phrase.default': { + 'query': 'test', + 'analyzer': 'peliasPhrase', + 'type': 'phrase', + 'slop': 2, + 'boost': 1 } } }, - 'max_boost': 2, + 'max_boost': 10000, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { - 'or': [ - { - 'type': { - 'value': 'admin0' - } - }, - { - 'type': { - 'value': 'admin1' - } - }, - { - 'type': { - 'value': 'admin2' - } - } - ] + 'exists': { + 'field': 'popularity' + } }, 'functions': [{ 'field_value_factor': { @@ -94,6 +81,35 @@ module.exports = { 'weight': 1 }] } + },{ + 'function_score': { + 'query': { + 'match': { + 'phrase.default': { + 'query': 'test', + 'analyzer': 'peliasPhrase', + 'type': 'phrase', + 'slop': 2, + 'boost': 1 + } + } + }, + 'max_boost': 2000, + 'score_mode': 'first', + 'boost_mode': 'replace', + 'filter': { + 'exists': { + 'field': 'population' + } + }, + 'functions': [{ + 'field_value_factor': { + 'modifier': 'sqrt', + 'field': 'population' + }, + 'weight': 1 + }] + } }] } } diff --git a/test/unit/fixture/search_linguistic_only.js b/test/unit/fixture/search_linguistic_only.js index ac059ef1..65db3fc8 100644 --- a/test/unit/fixture/search_linguistic_only.js +++ b/test/unit/fixture/search_linguistic_only.js @@ -23,39 +23,26 @@ module.exports = { 'slop': 2 } } - }, - { + },{ 'function_score': { 'query': { - 'filtered': { - 'filter': { - 'exists': { - 'field': 'popularity' - } + 'match': { + 'phrase.default': { + 'query': 'test', + 'analyzer': 'peliasPhrase', + 'type': 'phrase', + 'slop': 2, + 'boost': 1 } } }, - 'max_boost': 2, + 'max_boost': 10000, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { - 'or': [ - { - 'type': { - 'value': 'admin0' - } - }, - { - 'type': { - 'value': 'admin1' - } - }, - { - 'type': { - 'value': 'admin2' - } - } - ] + 'exists': { + 'field': 'popularity' + } }, 'functions': [{ 'field_value_factor': { @@ -65,6 +52,35 @@ module.exports = { 'weight': 1 }] } + },{ + 'function_score': { + 'query': { + 'match': { + 'phrase.default': { + 'query': 'test', + 'analyzer': 'peliasPhrase', + 'type': 'phrase', + 'slop': 2, + 'boost': 1 + } + } + }, + 'max_boost': 2000, + 'score_mode': 'first', + 'boost_mode': 'replace', + 'filter': { + 'exists': { + 'field': 'population' + } + }, + 'functions': [{ + 'field_value_factor': { + 'modifier': 'sqrt', + 'field': 'population' + }, + 'weight': 1 + }] + } }] } } @@ -73,4 +89,4 @@ module.exports = { 'sort': [ '_score' ], 'size': 10, 'track_scores': true -}; \ No newline at end of file +}; diff --git a/test/unit/fixture/search_partial_address.js b/test/unit/fixture/search_partial_address.js index 94210bf5..d60ebf36 100644 --- a/test/unit/fixture/search_partial_address.js +++ b/test/unit/fixture/search_partial_address.js @@ -26,39 +26,26 @@ module.exports = { 'boost': 1 } } - }, - { + },{ 'function_score': { 'query': { - 'filtered': { - 'filter': { - 'exists': { - 'field': 'popularity' - } + 'match': { + 'phrase.default': { + 'query': 'soho grand', + 'analyzer': 'peliasPhrase', + 'type': 'phrase', + 'slop': 2, + 'boost': 1 } } }, - 'max_boost': 2, + 'max_boost': 10000, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { - 'or': [ - { - 'type': { - 'value': 'admin0' - } - }, - { - 'type': { - 'value': 'admin1' - } - }, - { - 'type': { - 'value': 'admin2' - } - } - ] + 'exists': { + 'field': 'popularity' + } }, 'functions': [{ 'field_value_factor': { @@ -68,6 +55,35 @@ module.exports = { 'weight': 1 }] } + },{ + 'function_score': { + 'query': { + 'match': { + 'phrase.default': { + 'query': 'soho grand', + 'analyzer': 'peliasPhrase', + 'type': 'phrase', + 'slop': 2, + 'boost': 1 + } + } + }, + 'max_boost': 2000, + 'score_mode': 'first', + 'boost_mode': 'replace', + 'filter': { + 'exists': { + 'field': 'population' + } + }, + 'functions': [{ + 'field_value_factor': { + 'modifier': 'sqrt', + 'field': 'population' + }, + 'weight': 1 + }] + } },{ 'match': { 'admin0': { @@ -132,4 +148,4 @@ module.exports = { 'size': 10, 'sort': [ '_score' ], 'track_scores': true -}; \ No newline at end of file +}; diff --git a/test/unit/fixture/search_regions_address.js b/test/unit/fixture/search_regions_address.js index 05d4ffe5..17e32ab4 100644 --- a/test/unit/fixture/search_regions_address.js +++ b/test/unit/fixture/search_regions_address.js @@ -26,39 +26,26 @@ module.exports = { 'boost': 1 } } - }, - { + },{ 'function_score': { 'query': { - 'filtered': { - 'filter': { - 'exists': { - 'field': 'popularity' - } + 'match': { + 'phrase.default': { + 'query': '1 water st', + 'analyzer': 'peliasPhrase', + 'type': 'phrase', + 'slop': 2, + 'boost': 1 } } }, - 'max_boost': 2, + 'max_boost': 10000, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { - 'or': [ - { - 'type': { - 'value': 'admin0' - } - }, - { - 'type': { - 'value': 'admin1' - } - }, - { - 'type': { - 'value': 'admin2' - } - } - ] + 'exists': { + 'field': 'popularity' + } }, 'functions': [{ 'field_value_factor': { @@ -68,6 +55,35 @@ module.exports = { 'weight': 1 }] } + },{ + 'function_score': { + 'query': { + 'match': { + 'phrase.default': { + 'query': '1 water st', + 'analyzer': 'peliasPhrase', + 'type': 'phrase', + 'slop': 2, + 'boost': 1 + } + } + }, + 'max_boost': 2000, + 'score_mode': 'first', + 'boost_mode': 'replace', + 'filter': { + 'exists': { + 'field': 'population' + } + }, + 'functions': [{ + 'field_value_factor': { + 'modifier': 'sqrt', + 'field': 'population' + }, + 'weight': 1 + }] + } },{ 'match': { 'address.number': { @@ -148,4 +164,4 @@ module.exports = { 'size': 10, 'sort': [ '_score' ], 'track_scores': true -}; \ No newline at end of file +}; From 481a65a4f903959ef3406bf82b4ae3be80cec3f0 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Wed, 7 Oct 2015 20:37:10 +0200 Subject: [PATCH 2/4] population twice as important as popularity --- query/defaults.js | 2 +- test/unit/fixture/autocomplete_linguistic_focus.js | 2 +- test/unit/fixture/autocomplete_linguistic_focus_null_island.js | 2 +- test/unit/fixture/autocomplete_linguistic_only.js | 2 +- test/unit/fixture/search_boundary_country.js | 2 +- test/unit/fixture/search_full_address.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_partial_address.js | 2 +- test/unit/fixture/search_regions_address.js | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/query/defaults.js b/query/defaults.js index 7b761ae6..ce0a5aea 100644 --- a/query/defaults.js +++ b/query/defaults.js @@ -89,6 +89,6 @@ module.exports = extend( false, peliasQuery.defaults, { 'population:field': 'population', 'population:modifier': 'sqrt', 'population:max_boost': 2000, - 'population:weight': 1 + 'population:weight': 2 }); diff --git a/test/unit/fixture/autocomplete_linguistic_focus.js b/test/unit/fixture/autocomplete_linguistic_focus.js index 31404731..6cd43f52 100644 --- a/test/unit/fixture/autocomplete_linguistic_focus.js +++ b/test/unit/fixture/autocomplete_linguistic_focus.js @@ -105,7 +105,7 @@ module.exports = { 'modifier': 'sqrt', 'field': 'population' }, - 'weight': 1 + 'weight': 2 }] } }] diff --git a/test/unit/fixture/autocomplete_linguistic_focus_null_island.js b/test/unit/fixture/autocomplete_linguistic_focus_null_island.js index 2f46b9b0..063d0804 100644 --- a/test/unit/fixture/autocomplete_linguistic_focus_null_island.js +++ b/test/unit/fixture/autocomplete_linguistic_focus_null_island.js @@ -105,7 +105,7 @@ module.exports = { 'modifier': 'sqrt', 'field': 'population' }, - 'weight': 1 + 'weight': 2 }] } }] diff --git a/test/unit/fixture/autocomplete_linguistic_only.js b/test/unit/fixture/autocomplete_linguistic_only.js index 65db3fc8..e60d84d9 100644 --- a/test/unit/fixture/autocomplete_linguistic_only.js +++ b/test/unit/fixture/autocomplete_linguistic_only.js @@ -78,7 +78,7 @@ module.exports = { 'modifier': 'sqrt', 'field': 'population' }, - 'weight': 1 + 'weight': 2 }] } }] diff --git a/test/unit/fixture/search_boundary_country.js b/test/unit/fixture/search_boundary_country.js index 76f2c44c..ffa6e6bd 100644 --- a/test/unit/fixture/search_boundary_country.js +++ b/test/unit/fixture/search_boundary_country.js @@ -88,7 +88,7 @@ module.exports = { 'modifier': 'sqrt', 'field': 'population' }, - 'weight': 1 + 'weight': 2 }] } }] diff --git a/test/unit/fixture/search_full_address.js b/test/unit/fixture/search_full_address.js index 0abf05b1..205576bc 100644 --- a/test/unit/fixture/search_full_address.js +++ b/test/unit/fixture/search_full_address.js @@ -82,7 +82,7 @@ module.exports = { 'modifier': 'sqrt', 'field': 'population' }, - 'weight': 1 + 'weight': 2 }] } },{ diff --git a/test/unit/fixture/search_linguistic_bbox.js b/test/unit/fixture/search_linguistic_bbox.js index 738d1b83..8b102f9b 100644 --- a/test/unit/fixture/search_linguistic_bbox.js +++ b/test/unit/fixture/search_linguistic_bbox.js @@ -78,7 +78,7 @@ module.exports = { 'modifier': 'sqrt', 'field': 'population' }, - 'weight': 1 + 'weight': 2 }] } }] diff --git a/test/unit/fixture/search_linguistic_focus.js b/test/unit/fixture/search_linguistic_focus.js index c20ddbf9..2a0a8deb 100644 --- a/test/unit/fixture/search_linguistic_focus.js +++ b/test/unit/fixture/search_linguistic_focus.js @@ -107,7 +107,7 @@ module.exports = { 'modifier': 'sqrt', 'field': 'population' }, - 'weight': 1 + 'weight': 2 }] } }] diff --git a/test/unit/fixture/search_linguistic_focus_bbox.js b/test/unit/fixture/search_linguistic_focus_bbox.js index 92301fa6..3f16ce93 100644 --- a/test/unit/fixture/search_linguistic_focus_bbox.js +++ b/test/unit/fixture/search_linguistic_focus_bbox.js @@ -107,7 +107,7 @@ module.exports = { 'modifier': 'sqrt', 'field': 'population' }, - 'weight': 1 + 'weight': 2 }] } }] diff --git a/test/unit/fixture/search_linguistic_focus_null_island.js b/test/unit/fixture/search_linguistic_focus_null_island.js index 85e6d40a..f734d1ff 100644 --- a/test/unit/fixture/search_linguistic_focus_null_island.js +++ b/test/unit/fixture/search_linguistic_focus_null_island.js @@ -107,7 +107,7 @@ module.exports = { 'modifier': 'sqrt', 'field': 'population' }, - 'weight': 1 + 'weight': 2 }] } }] diff --git a/test/unit/fixture/search_linguistic_only.js b/test/unit/fixture/search_linguistic_only.js index 65db3fc8..e60d84d9 100644 --- a/test/unit/fixture/search_linguistic_only.js +++ b/test/unit/fixture/search_linguistic_only.js @@ -78,7 +78,7 @@ module.exports = { 'modifier': 'sqrt', 'field': 'population' }, - 'weight': 1 + 'weight': 2 }] } }] diff --git a/test/unit/fixture/search_partial_address.js b/test/unit/fixture/search_partial_address.js index d60ebf36..72ef8c02 100644 --- a/test/unit/fixture/search_partial_address.js +++ b/test/unit/fixture/search_partial_address.js @@ -81,7 +81,7 @@ module.exports = { 'modifier': 'sqrt', 'field': 'population' }, - 'weight': 1 + 'weight': 2 }] } },{ diff --git a/test/unit/fixture/search_regions_address.js b/test/unit/fixture/search_regions_address.js index 17e32ab4..047a2ffe 100644 --- a/test/unit/fixture/search_regions_address.js +++ b/test/unit/fixture/search_regions_address.js @@ -81,7 +81,7 @@ module.exports = { 'modifier': 'sqrt', 'field': 'population' }, - 'weight': 1 + 'weight': 2 }] } },{ From 2ce249ad30111111a4c625eca59ca853a0908f12 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Thu, 8 Oct 2015 06:53:48 +0200 Subject: [PATCH 3/4] adjust balance between population/popularity and focus --- package.json | 2 +- query/defaults.js | 1 + test/unit/fixture/autocomplete_linguistic_focus.js | 3 ++- test/unit/fixture/autocomplete_linguistic_focus_null_island.js | 3 ++- test/unit/fixture/search_linguistic_focus.js | 3 ++- test/unit/fixture/search_linguistic_focus_bbox.js | 3 ++- test/unit/fixture/search_linguistic_focus_null_island.js | 3 ++- 7 files changed, 12 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 9cf371b9..da77a3df 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "pelias-config": "^1.0.1", "pelias-esclient": "0.0.25", "pelias-logger": "^0.0.8", - "pelias-query": "4.0.0", + "pelias-query": "^5.0.0", "pelias-schema": "1.0.0", "pelias-suggester-pipeline": "2.0.2", "stats-lite": "^1.0.3", diff --git a/query/defaults.js b/query/defaults.js index ce0a5aea..b8ce5ad1 100644 --- a/query/defaults.js +++ b/query/defaults.js @@ -33,6 +33,7 @@ module.exports = extend( false, peliasQuery.defaults, { 'focus:offset': '1km', 'focus:scale': '50km', 'focus:decay': 0.5, + 'focus:weight': 2, 'function_score:score_mode': 'avg', 'function_score:boost_mode': 'replace', diff --git a/test/unit/fixture/autocomplete_linguistic_focus.js b/test/unit/fixture/autocomplete_linguistic_focus.js index 6cd43f52..78f42c7f 100644 --- a/test/unit/fixture/autocomplete_linguistic_focus.js +++ b/test/unit/fixture/autocomplete_linguistic_focus.js @@ -45,7 +45,8 @@ module.exports = { 'scale': '50km', 'decay': 0.5 } - } + }, + 'weight': 2 }], 'score_mode': 'avg', 'boost_mode': 'replace' diff --git a/test/unit/fixture/autocomplete_linguistic_focus_null_island.js b/test/unit/fixture/autocomplete_linguistic_focus_null_island.js index 063d0804..c12995f2 100644 --- a/test/unit/fixture/autocomplete_linguistic_focus_null_island.js +++ b/test/unit/fixture/autocomplete_linguistic_focus_null_island.js @@ -45,7 +45,8 @@ module.exports = { 'scale': '50km', 'decay': 0.5 } - } + }, + 'weight': 2 }], 'score_mode': 'avg', 'boost_mode': 'replace' diff --git a/test/unit/fixture/search_linguistic_focus.js b/test/unit/fixture/search_linguistic_focus.js index 2a0a8deb..59227c5c 100644 --- a/test/unit/fixture/search_linguistic_focus.js +++ b/test/unit/fixture/search_linguistic_focus.js @@ -47,7 +47,8 @@ module.exports = { 'scale': '50km', 'decay': 0.5 } - } + }, + 'weight': 2 }], 'score_mode': 'avg', 'boost_mode': 'replace' diff --git a/test/unit/fixture/search_linguistic_focus_bbox.js b/test/unit/fixture/search_linguistic_focus_bbox.js index 3f16ce93..4c2fadb9 100644 --- a/test/unit/fixture/search_linguistic_focus_bbox.js +++ b/test/unit/fixture/search_linguistic_focus_bbox.js @@ -47,7 +47,8 @@ module.exports = { 'scale': '50km', 'decay': 0.5 } - } + }, + 'weight': 2 }], 'score_mode': 'avg', 'boost_mode': 'replace' diff --git a/test/unit/fixture/search_linguistic_focus_null_island.js b/test/unit/fixture/search_linguistic_focus_null_island.js index f734d1ff..4290cfed 100644 --- a/test/unit/fixture/search_linguistic_focus_null_island.js +++ b/test/unit/fixture/search_linguistic_focus_null_island.js @@ -47,7 +47,8 @@ module.exports = { 'scale': '50km', 'decay': 0.5 } - } + }, + 'weight': 2 }], 'score_mode': 'avg', 'boost_mode': 'replace' From 8ceac4cbb0001dfdc93ddd7cb16183c54e123062 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Thu, 8 Oct 2015 07:40:08 +0200 Subject: [PATCH 4/4] change modifier function from sqrt() to log1p() and adjust max_boost --- query/defaults.js | 8 ++++---- test/unit/fixture/autocomplete_linguistic_focus.js | 8 ++++---- .../fixture/autocomplete_linguistic_focus_null_island.js | 8 ++++---- test/unit/fixture/autocomplete_linguistic_only.js | 8 ++++---- test/unit/fixture/search_boundary_country.js | 8 ++++---- test/unit/fixture/search_full_address.js | 8 ++++---- test/unit/fixture/search_linguistic_bbox.js | 8 ++++---- test/unit/fixture/search_linguistic_focus.js | 8 ++++---- test/unit/fixture/search_linguistic_focus_bbox.js | 8 ++++---- test/unit/fixture/search_linguistic_focus_null_island.js | 8 ++++---- test/unit/fixture/search_linguistic_only.js | 8 ++++---- test/unit/fixture/search_partial_address.js | 8 ++++---- test/unit/fixture/search_regions_address.js | 8 ++++---- 13 files changed, 52 insertions(+), 52 deletions(-) diff --git a/query/defaults.js b/query/defaults.js index b8ce5ad1..b61e84ac 100644 --- a/query/defaults.js +++ b/query/defaults.js @@ -83,13 +83,13 @@ module.exports = extend( false, peliasQuery.defaults, { 'admin:neighborhood:boost': 1, 'popularity:field': 'popularity', - 'popularity:modifier': 'sqrt', - 'popularity:max_boost': 10000, + 'popularity:modifier': 'log1p', + 'popularity:max_boost': 20, 'popularity:weight': 1, 'population:field': 'population', - 'population:modifier': 'sqrt', - 'population:max_boost': 2000, + 'population:modifier': 'log1p', + 'population:max_boost': 20, 'population:weight': 2 }); diff --git a/test/unit/fixture/autocomplete_linguistic_focus.js b/test/unit/fixture/autocomplete_linguistic_focus.js index 78f42c7f..8d0e9914 100644 --- a/test/unit/fixture/autocomplete_linguistic_focus.js +++ b/test/unit/fixture/autocomplete_linguistic_focus.js @@ -64,7 +64,7 @@ module.exports = { } } }, - 'max_boost': 10000, + 'max_boost': 20, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { @@ -74,7 +74,7 @@ module.exports = { }, 'functions': [{ 'field_value_factor': { - 'modifier': 'sqrt', + 'modifier': 'log1p', 'field': 'popularity' }, 'weight': 1 @@ -93,7 +93,7 @@ module.exports = { } } }, - 'max_boost': 2000, + 'max_boost': 20, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { @@ -103,7 +103,7 @@ module.exports = { }, 'functions': [{ 'field_value_factor': { - 'modifier': 'sqrt', + 'modifier': 'log1p', 'field': 'population' }, 'weight': 2 diff --git a/test/unit/fixture/autocomplete_linguistic_focus_null_island.js b/test/unit/fixture/autocomplete_linguistic_focus_null_island.js index c12995f2..8300b026 100644 --- a/test/unit/fixture/autocomplete_linguistic_focus_null_island.js +++ b/test/unit/fixture/autocomplete_linguistic_focus_null_island.js @@ -64,7 +64,7 @@ module.exports = { } } }, - 'max_boost': 10000, + 'max_boost': 20, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { @@ -74,7 +74,7 @@ module.exports = { }, 'functions': [{ 'field_value_factor': { - 'modifier': 'sqrt', + 'modifier': 'log1p', 'field': 'popularity' }, 'weight': 1 @@ -93,7 +93,7 @@ module.exports = { } } }, - 'max_boost': 2000, + 'max_boost': 20, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { @@ -103,7 +103,7 @@ module.exports = { }, 'functions': [{ 'field_value_factor': { - 'modifier': 'sqrt', + 'modifier': 'log1p', 'field': 'population' }, 'weight': 2 diff --git a/test/unit/fixture/autocomplete_linguistic_only.js b/test/unit/fixture/autocomplete_linguistic_only.js index e60d84d9..53ece28e 100644 --- a/test/unit/fixture/autocomplete_linguistic_only.js +++ b/test/unit/fixture/autocomplete_linguistic_only.js @@ -36,7 +36,7 @@ module.exports = { } } }, - 'max_boost': 10000, + 'max_boost': 20, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { @@ -46,7 +46,7 @@ module.exports = { }, 'functions': [{ 'field_value_factor': { - 'modifier': 'sqrt', + 'modifier': 'log1p', 'field': 'popularity' }, 'weight': 1 @@ -65,7 +65,7 @@ module.exports = { } } }, - 'max_boost': 2000, + 'max_boost': 20, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { @@ -75,7 +75,7 @@ module.exports = { }, 'functions': [{ 'field_value_factor': { - 'modifier': 'sqrt', + 'modifier': 'log1p', 'field': 'population' }, 'weight': 2 diff --git a/test/unit/fixture/search_boundary_country.js b/test/unit/fixture/search_boundary_country.js index ffa6e6bd..3e6f83bc 100644 --- a/test/unit/fixture/search_boundary_country.js +++ b/test/unit/fixture/search_boundary_country.js @@ -46,7 +46,7 @@ module.exports = { } } }, - 'max_boost': 10000, + 'max_boost': 20, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { @@ -56,7 +56,7 @@ module.exports = { }, 'functions': [{ 'field_value_factor': { - 'modifier': 'sqrt', + 'modifier': 'log1p', 'field': 'popularity' }, 'weight': 1 @@ -75,7 +75,7 @@ module.exports = { } } }, - 'max_boost': 2000, + 'max_boost': 20, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { @@ -85,7 +85,7 @@ module.exports = { }, 'functions': [{ 'field_value_factor': { - 'modifier': 'sqrt', + 'modifier': 'log1p', 'field': 'population' }, 'weight': 2 diff --git a/test/unit/fixture/search_full_address.js b/test/unit/fixture/search_full_address.js index 205576bc..93572705 100644 --- a/test/unit/fixture/search_full_address.js +++ b/test/unit/fixture/search_full_address.js @@ -40,7 +40,7 @@ module.exports = { } } }, - 'max_boost': 10000, + 'max_boost': 20, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { @@ -50,7 +50,7 @@ module.exports = { }, 'functions': [{ 'field_value_factor': { - 'modifier': 'sqrt', + 'modifier': 'log1p', 'field': 'popularity' }, 'weight': 1 @@ -69,7 +69,7 @@ module.exports = { } } }, - 'max_boost': 2000, + 'max_boost': 20, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { @@ -79,7 +79,7 @@ module.exports = { }, 'functions': [{ 'field_value_factor': { - 'modifier': 'sqrt', + 'modifier': 'log1p', 'field': 'population' }, 'weight': 2 diff --git a/test/unit/fixture/search_linguistic_bbox.js b/test/unit/fixture/search_linguistic_bbox.js index 8b102f9b..6e6676d5 100644 --- a/test/unit/fixture/search_linguistic_bbox.js +++ b/test/unit/fixture/search_linguistic_bbox.js @@ -36,7 +36,7 @@ module.exports = { } } }, - 'max_boost': 10000, + 'max_boost': 20, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { @@ -46,7 +46,7 @@ module.exports = { }, 'functions': [{ 'field_value_factor': { - 'modifier': 'sqrt', + 'modifier': 'log1p', 'field': 'popularity' }, 'weight': 1 @@ -65,7 +65,7 @@ module.exports = { } } }, - 'max_boost': 2000, + 'max_boost': 20, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { @@ -75,7 +75,7 @@ module.exports = { }, 'functions': [{ 'field_value_factor': { - 'modifier': 'sqrt', + 'modifier': 'log1p', 'field': 'population' }, 'weight': 2 diff --git a/test/unit/fixture/search_linguistic_focus.js b/test/unit/fixture/search_linguistic_focus.js index 59227c5c..36cb2912 100644 --- a/test/unit/fixture/search_linguistic_focus.js +++ b/test/unit/fixture/search_linguistic_focus.js @@ -66,7 +66,7 @@ module.exports = { } } }, - 'max_boost': 10000, + 'max_boost': 20, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { @@ -76,7 +76,7 @@ module.exports = { }, 'functions': [{ 'field_value_factor': { - 'modifier': 'sqrt', + 'modifier': 'log1p', 'field': 'popularity' }, 'weight': 1 @@ -95,7 +95,7 @@ module.exports = { } } }, - 'max_boost': 2000, + 'max_boost': 20, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { @@ -105,7 +105,7 @@ module.exports = { }, 'functions': [{ 'field_value_factor': { - 'modifier': 'sqrt', + 'modifier': 'log1p', 'field': 'population' }, 'weight': 2 diff --git a/test/unit/fixture/search_linguistic_focus_bbox.js b/test/unit/fixture/search_linguistic_focus_bbox.js index 4c2fadb9..4932d56b 100644 --- a/test/unit/fixture/search_linguistic_focus_bbox.js +++ b/test/unit/fixture/search_linguistic_focus_bbox.js @@ -66,7 +66,7 @@ module.exports = { } } }, - 'max_boost': 10000, + 'max_boost': 20, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { @@ -76,7 +76,7 @@ module.exports = { }, 'functions': [{ 'field_value_factor': { - 'modifier': 'sqrt', + 'modifier': 'log1p', 'field': 'popularity' }, 'weight': 1 @@ -95,7 +95,7 @@ module.exports = { } } }, - 'max_boost': 2000, + 'max_boost': 20, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { @@ -105,7 +105,7 @@ module.exports = { }, 'functions': [{ 'field_value_factor': { - 'modifier': 'sqrt', + 'modifier': 'log1p', 'field': 'population' }, 'weight': 2 diff --git a/test/unit/fixture/search_linguistic_focus_null_island.js b/test/unit/fixture/search_linguistic_focus_null_island.js index 4290cfed..04116c55 100644 --- a/test/unit/fixture/search_linguistic_focus_null_island.js +++ b/test/unit/fixture/search_linguistic_focus_null_island.js @@ -66,7 +66,7 @@ module.exports = { } } }, - 'max_boost': 10000, + 'max_boost': 20, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { @@ -76,7 +76,7 @@ module.exports = { }, 'functions': [{ 'field_value_factor': { - 'modifier': 'sqrt', + 'modifier': 'log1p', 'field': 'popularity' }, 'weight': 1 @@ -95,7 +95,7 @@ module.exports = { } } }, - 'max_boost': 2000, + 'max_boost': 20, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { @@ -105,7 +105,7 @@ module.exports = { }, 'functions': [{ 'field_value_factor': { - 'modifier': 'sqrt', + 'modifier': 'log1p', 'field': 'population' }, 'weight': 2 diff --git a/test/unit/fixture/search_linguistic_only.js b/test/unit/fixture/search_linguistic_only.js index e60d84d9..53ece28e 100644 --- a/test/unit/fixture/search_linguistic_only.js +++ b/test/unit/fixture/search_linguistic_only.js @@ -36,7 +36,7 @@ module.exports = { } } }, - 'max_boost': 10000, + 'max_boost': 20, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { @@ -46,7 +46,7 @@ module.exports = { }, 'functions': [{ 'field_value_factor': { - 'modifier': 'sqrt', + 'modifier': 'log1p', 'field': 'popularity' }, 'weight': 1 @@ -65,7 +65,7 @@ module.exports = { } } }, - 'max_boost': 2000, + 'max_boost': 20, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { @@ -75,7 +75,7 @@ module.exports = { }, 'functions': [{ 'field_value_factor': { - 'modifier': 'sqrt', + 'modifier': 'log1p', 'field': 'population' }, 'weight': 2 diff --git a/test/unit/fixture/search_partial_address.js b/test/unit/fixture/search_partial_address.js index 72ef8c02..6e0fbd5b 100644 --- a/test/unit/fixture/search_partial_address.js +++ b/test/unit/fixture/search_partial_address.js @@ -39,7 +39,7 @@ module.exports = { } } }, - 'max_boost': 10000, + 'max_boost': 20, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { @@ -49,7 +49,7 @@ module.exports = { }, 'functions': [{ 'field_value_factor': { - 'modifier': 'sqrt', + 'modifier': 'log1p', 'field': 'popularity' }, 'weight': 1 @@ -68,7 +68,7 @@ module.exports = { } } }, - 'max_boost': 2000, + 'max_boost': 20, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { @@ -78,7 +78,7 @@ module.exports = { }, 'functions': [{ 'field_value_factor': { - 'modifier': 'sqrt', + 'modifier': 'log1p', 'field': 'population' }, 'weight': 2 diff --git a/test/unit/fixture/search_regions_address.js b/test/unit/fixture/search_regions_address.js index 047a2ffe..cc04943b 100644 --- a/test/unit/fixture/search_regions_address.js +++ b/test/unit/fixture/search_regions_address.js @@ -39,7 +39,7 @@ module.exports = { } } }, - 'max_boost': 10000, + 'max_boost': 20, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { @@ -49,7 +49,7 @@ module.exports = { }, 'functions': [{ 'field_value_factor': { - 'modifier': 'sqrt', + 'modifier': 'log1p', 'field': 'popularity' }, 'weight': 1 @@ -68,7 +68,7 @@ module.exports = { } } }, - 'max_boost': 2000, + 'max_boost': 20, 'score_mode': 'first', 'boost_mode': 'replace', 'filter': { @@ -78,7 +78,7 @@ module.exports = { }, 'functions': [{ 'field_value_factor': { - 'modifier': 'sqrt', + 'modifier': 'log1p', 'field': 'population' }, 'weight': 2