From 7d3e4a0e83d531e57ad1f398ac3f77696f0dde17 Mon Sep 17 00:00:00 2001 From: Julian Simioni Date: Mon, 13 Jul 2020 16:29:03 -0700 Subject: [PATCH] feat(autocomplete): Turn off address parts scoring This change removes several `should` conditions from autocomplete Elasticsearch queries. After analysis in https://github.com/pelias/api/pull/1469 it appears that these `should` conditions do not particularly influence address rseults, but hinder POI results from appearing correctly. While we might want to tweak things in the future, such as applying a very small scoring boost for matching postal codes, in general for autocomplete it seems these conditions are overall not helpful. Closes https://github.com/pelias/api/issues/1308 --- query/autocomplete.js | 6 ------ .../fixture/autocomplete_single_character_street.js | 10 ---------- 2 files changed, 16 deletions(-) diff --git a/query/autocomplete.js b/query/autocomplete.js index 6cae73fc7..ad98b1307 100644 --- a/query/autocomplete.js +++ b/query/autocomplete.js @@ -47,12 +47,6 @@ query.score( views.ngrams_last_token_only_multi( adminFields ), 'must' ); query.score( views.admin_multi_match_first( adminFields ), 'must'); query.score( views.admin_multi_match_last( adminFields ), 'must'); -// address components -query.score( peliasQuery.view.address('housenumber') ); -query.score( peliasQuery.view.address('street') ); -query.score( peliasQuery.view.address('cross_street') ); -query.score( peliasQuery.view.address('postcode') ); - // scoring boost query.score( peliasQuery.view.focus( views.ngrams_strict ) ); query.score( peliasQuery.view.popularity( peliasQuery.view.leaf.match_all ) ); diff --git a/test/unit/fixture/autocomplete_single_character_street.js b/test/unit/fixture/autocomplete_single_character_street.js index 0f6ed21a2..fce06d111 100644 --- a/test/unit/fixture/autocomplete_single_character_street.js +++ b/test/unit/fixture/autocomplete_single_character_street.js @@ -33,16 +33,6 @@ module.exports = { } }], 'should':[ - { - 'match': { - 'address_parts.street': { - 'query': 'k road', - 'cutoff_frequency': 0.01, - 'boost': 1, - 'analyzer': 'peliasQuery' - } - } - }, { 'function_score': { 'query': {