pelias / api

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

Confidence seems to be calculated incorectly #1488

Closed hannojg closed 3 years ago

hannojg commented 4 years ago

Describe the bug We are searching for a venue with a focus point. The focus point is the city. The venue is a restaurant chain, so it has branches in many cities. We expect, that the restaurant at the focus point is the first result with the confidence of one. However, the first result is of a venue in a completely different city with confidence being 1.

Steps to Reproduce

  1. Run this query: https://pelias.github.io/compare/#/v1/search?layers=venue&focus.point.lat=53.867646&focus.point.lon=10.690266&text=Losteria
  2. The focus point is the city "Lübeck"
  3. You can see that the first result is the Losteria, Mannheim (very far away from the focused city "Lübeck") with a confidence of 1.

Expected behaviour "Losteria, Lübeck" is the first entry with a confidence of 1 as the focal point is more close to this place than the other.

Environment (please complete the following information):

Pastebin/Screenshots

Screenshot 2020-09-10 at 13 20 06
missinglink commented 4 years ago

Hmm.. this is working correctly for autocomplete but not for search, it seems the only real difference in the scoring algorithm is the weight which is substantially more for autocomplete.

Screenshot 2020-09-10 at 14 19 00

cc/ @orangejulius should we consider increasing the weight for /v1/search?

thanks for the test case @hannojg

missinglink commented 4 years ago

This is the relevant config variable, you can change it and restart the server: https://github.com/pelias/api/blob/master/query/search_defaults.js#L34

If you're running inside Docker it's a little trickier, you'll need to copy the file to your local machine, make the change and then bind mount it over the copy inside the container.

An example of such a 'bind mount' can be found here: https://github.com/pelias/docker/blob/master/projects/portland-metro/docker-compose.yml#L17

The location of that file inside the container is /home/pelias/query/search_defaults.js

orangejulius commented 4 years ago

Hi folks! This actually looks like a duplicate of https://github.com/pelias/openstreetmap/issues/507: the restaurant from Mannheim has an alt_name: Losteria tag in OSM, so it gets a scoring boost for matching the text input twice.

Over in that issue I discussed the idea of doing some very basic work to detect near-duplicate alt-names like this, as a bit of a stopgap until we can implement the real fix of improving our alt-name system.