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.
Background
With pelias/api#1300 I added some cool feature for i18n autocomplete. But there are some limitations, such as the search of
Parijs, Frankrijk
, due to hierarchy index limitation.Since we have #446 and the support for multi-lang names property in OSM, we can search for both OSM venues/addresses and WOF by their non-default/English name.
This means that if we do an autocomplete of
Parijs
(withlang=nl
and pelias/api#1300) we will get Paris 👍 but if you do an autocomplete ofParijs, Frankrijk
we will get no results 👎.Why ?
Because the API will search a document with a name property
Parijs
AND in its hierarchy (country, locality...)Frankrijk
. But in our ES index, we only have the default name in document hierarchy. SoFrankrijk
is not in theParijs
hierarchy... OnlyFrance
is present.How to get rid of this ?
We do not have many solutions... I found only 2.
Pont Neuf, Parijs, Frankrijk
:source=wof AND (name.lang='Parijs' or name.lang='Frankrijk')
and take their ids.Pont Neuf
which is in the hierarchy found lately, something likename.lang='Pont Neuf' AND (country.id IN ('whosonfirst:country:85633147', 'whosonfirst:locality:101751119') OR locality IN ('whosonfirst:country:85633147', 'whosonfirst:locality:101751119'))
In this PR I tried the first solution and here are my results for France:
All names in
parent.placetype
First try with all names in
parent.placetype
without duplicates.Parijs, Frankrijk
works with Use default index + user-lang index in autocomplete api#1300 andlang=nl
This first test is not the right one in my opinion. I will try some alternatives 😄
related: pelias/api#1296
related: pelias/api#1300