autocomplete: use should instead of must for admin matching #1505
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi there,
Background
Currently when we do an autocomplete including subject + admin part in a language different than English, we receive no results. The example I often use is
Parijs, Frankrijk
in Dutch.First try
After the fail of pelias/whosonfirst#492, I was looking for an alternative to get a result for
Parijs, Frankrijk
in Dutch.In ES, pelias documents contain this information:
name.fr = [Paris, Ville-Lumière]
,name.nl = Parijs
...)parent.country = France
,parent.macroregion = Île-De-France
...)The idea here was to use two ES queries for one autocomplete with this workflow:
pelias-parser
name = Frankrijk
orname.nl = Frankrijk
with a coarse layershould
clause whereparent.*_id = id
should
clause.This caused side effects (-3% in acceptance tests...), so I abandoned this solution... 😞
Second try
I moved the scoring of admin components from
must
clause toshould
. This solution probably won't solve all issues, but it's a good start.It works just fine with
Parijs, Frankrijk
and improved some queriesResults for
Parijs, Frankrijk
. Since this is autocomplete, I think it's not strange to have results that don't match 100% the name 🤔related #1296