Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept Language Header changes order of results #851

Closed
mrosendorff opened this issue Nov 21, 2024 · 1 comment
Closed

Accept Language Header changes order of results #851

mrosendorff opened this issue Nov 21, 2024 · 1 comment

Comments

@mrosendorff
Copy link

mrosendorff commented Nov 21, 2024

Hi

It seems changing the accept language changes the order of priority of the results.

Steps to reproduce:

Download the latest full world data

wget -O - https://download1.graphhopper.com/public/photon-db-latest.tar.bz2 | pbzip2 -cd | tar x

run the server

E.g:

When running

curl 'http://localhost:2322/api?q=52%207th%20avenue%20highlands%20north&lon=28&lat=-26&limit=2' \
  -H 'Accept-Language: en'

it returns

{
    "features": [
        {
            "geometry": {
                "coordinates": [
                    28.0809321,
                    -26.1448506
                ],
                "type": "Point"
            },
            "type": "Feature",
            "properties": {
                "osm_id": 595642546,
                "extent": [
                    28.0774512,
                    -26.1433878,
                    28.0866907,
                    -26.1457578
                ],
                "country": "South Africa",
                "city": "Johannesburg",
                "countrycode": "ZA",
                "postcode": "2001",
                "locality": "Highlands North",
                "county": "City of Johannesburg Metropolitan Municipality",
                "type": "street",
                "osm_type": "W",
                "osm_key": "highway",
                "district": "Johannesburg Ward 74",
                "osm_value": "residential",
                "name": "7th Avenue",
                "state": "Gauteng"
            }
        },
        {
            "geometry": {
                "coordinates": [
                    28.030820100589064,
                    -26.145169799999998
                ],
                "type": "Point"
            },
            "type": "Feature",
            "properties": {
                "osm_id": 640375958,
                "extent": [
                    28.0307452,
                    -26.1451041,
                    28.030895,
                    -26.1452356
                ],
                "country": "South Africa",
                "city": "Randburg",
                "countrycode": "ZA",
                "postcode": "2132",
                "locality": "Parktown North",
                "county": "City of Johannesburg Metropolitan Municipality",
                "type": "house",
                "osm_type": "W",
                "osm_key": "building",
                "housenumber": "52",
                "street": "7th Avenue",
                "district": "Johannesburg Ward 117",
                "osm_value": "yes",
                "state": "Gauteng"
            }
        }
    ],
    "type": "FeatureCollection"
}

Whereas if you leave the accept language off i.e.

curl ''http://localhost:2322/api?q=52%207th%20avenue%20highlands%20north&lon=28&lat=-26&limit=2" 

it moves the Highlands North result to position 3

{
    "features": [
        {
            "geometry": {
                "coordinates": [
                    28.030820100589064,
                    -26.145169799999998
                ],
                "type": "Point"
            },
            "type": "Feature",
            "properties": {
                "osm_id": 640375958,
                "extent": [
                    28.0307452,
                    -26.1451041,
                    28.030895,
                    -26.1452356
                ],
                "country": "South Africa",
                "city": "Randburg",
                "countrycode": "ZA",
                "postcode": "2132",
                "locality": "Parktown North",
                "county": "City of Johannesburg Metropolitan Municipality",
                "type": "house",
                "osm_type": "W",
                "osm_key": "building",
                "housenumber": "52",
                "street": "7th Avenue",
                "district": "Johannesburg Ward 117",
                "osm_value": "yes",
                "state": "Gauteng"
            }
        },
        {
            "geometry": {
                "coordinates": [
                    28.030818873512054,
                    -26.145538199999997
                ],
                "type": "Point"
            },
            "type": "Feature",
            "properties": {
                "osm_id": 640375957,
                "extent": [
                    28.0306882,
                    -26.1454305,
                    28.0309495,
                    -26.1456459
                ],
                "country": "South Africa",
                "city": "Randburg",
                "countrycode": "ZA",
                "postcode": "2132",
                "locality": "Parktown North",
                "county": "City of Johannesburg Metropolitan Municipality",
                "type": "house",
                "osm_type": "W",
                "osm_key": "building",
                "housenumber": "52A",
                "street": "7th Avenue",
                "district": "Johannesburg Ward 117",
                "osm_value": "house",
                "state": "Gauteng"
            }
        },
        {
            "geometry": {
                "coordinates": [
                    28.0809321,
                    -26.1448506
                ],
                "type": "Point"
            },
            "type": "Feature",
            "properties": {
                "osm_id": 595642546,
                "extent": [
                    28.0774512,
                    -26.1433878,
                    28.0866907,
                    -26.1457578
                ],
                "country": "South Africa",
                "city": "Johannesburg",
                "countrycode": "ZA",
                "postcode": "2001",
                "locality": "Highlands North",
                "county": "City of Johannesburg Metropolitan Municipality",
                "type": "street",
                "osm_type": "W",
                "osm_key": "highway",
                "district": "Johannesburg Ward 74",
                "osm_value": "residential",
                "name": "7th Avenue",
                "state": "Gauteng"
            }
        }
    ],
    "type": "FeatureCollection"
}

Whats fascinating about this is it only happens for house number 52, not any house around it.

@lonvia
Copy link
Collaborator

lonvia commented Nov 27, 2024

This is somewhat intentional (you are more likely to search for something in the language that you speak) but currently not well tuned.

Duplicate of #746.

@lonvia lonvia closed this as not planned Won't fix, can't repro, duplicate, stale Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants