pelias / api

HTTP API for Pelias Geocoder
http://pelias.io
MIT License
219 stars 162 forks source link

Wrong field in admin_multi_match_first query #1497

Open Joxit opened 4 years ago

Joxit commented 4 years ago

Describe the bug

Heeeeey @Joxit

I was investigating a bug report today and I noticed something on our dev server which looks incorrect: https://pelias.github.io/compare/#/v1/autocomplete?lang=de&text=Am+Gro%C3%9Fhausberg%2C+Furtwangen+im+Schwarzwald+deut&debug=1

Dev server is running a newer master branch than the production server.

Screenshot 2020-10-16 at 11 51 25

The screenshot shows it's using phrase.default but name.de, is that possibly due to this PR? I would expect to see phrase.default and phrase.de.

Originally posted by @missinglink in https://github.com/pelias/api/pull/1493#issuecomment-709947256

Expected behavior

We should use the phrase.{lang} field instead of name.{lang}.

Additional context

Here is where we update the name.default field to phrase.default:

https://github.com/pelias/api/blob/5d202c48c0753f34f3401bd0c451449d53cf1e6b/query/view/admin_multi_match_first.js#L32-L37

The lang from clean is not available in this function... We may add a new property lang in the view ?