Confidence score not correctly calculated with street names
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 259
- Forks
- 168
- Avg merge
- 6h 15m
- Merged PRs (30d)
- 1
Description
Describe the bug
Confidence score is always 1 for all features while subject (Lekarna - pharmacy in Slovenian), street name (Miklošičeva cesta) and city (Ljubljana) are given (and parsed correctly). I want to search for a pharmacy on Miklošičeva street in city Ljubljana. All features are pharmacies, but have incorrect confidence score.
Lets take the following request: http://pelias/v1/search?boundary.country=SVN&lang=sl-si&sources=osm&text=lekarna, miklošičeva cesta, ljubljana. All features have confidence score of 1, resulting in wrong order of best matching feature. The confidence score could definitely be calculated more accurately by using the street name, but for some reason it didn't.
The correct result is node/1894570012, which should have more confidence score than the rest, since street name matches perfectly. Please see response from Pelias below.
Steps to Reproduce
- Use OpenStreetMap dataset, could only be Slovenia, not necessarily global
- Call
http://pelias/v1/search?boundary.country=SVN&lang=sl-si&sources=osm&text=lekarna, miklošičeva cesta, ljubljana - Correct feature (
node/1894570012) is somewhere at the bottom - see response below
Expected behavior
Feature node/1894570012 or Lekarna Miklošič should have more confidence score than the rest due to same street name. This feature can be seen in the response below.
Environment (please complete the following information):
- OS: Mac
- Docker versions: v20.10.9, 1.28.2
Pastebin/Screenshots
Response from Pelias
{
"geocoding": {
"version": "0.2",
"attribution": "http://pelias/attribution",
"query": {
"text": "lekarna, miklošičeva cesta, ljubljana",
"size": 10,
"sources": [
"openstreetmap"
],
"layers": [
"venue",
"street"
],
"private": false,
"boundary.country": [
"SVN"
],
"lang": {
"name": "Slovenian",
"iso6391": "sl",
"iso6393": "slv",
"via": "querystring",
"defaulted": false
},
"querySize": 20,
"parser": "libpostal",
"parsed_text": {
"query": "lekarna",
"street": "miklošičeva cesta",
"city": "ljubljana"
}
},
"warnings": [
"performance optimization: excluding 'address' layer"
],
"engine": {
"name": "Pelias",
"author": "Mapzen",
"version": "1.0"
},
"timestamp": 1635169413727
},
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
14.486863,
46.046748
]
},
"properties": {
"id": "way/771509659",
"gid": "openstreetmap:venue:way/771509659",
"layer": "venue",
"source": "openstreetmap",
"source_id": "way/771509659",
"name": "Lekarna Vič",
"housenumber": "10",
"street": "Šestova ulica",
"postalcode": "1000",
"confidence": 1,
"match_type": "exact",
"accuracy": "point",
"country": "Slovenija",
"country_gid": "whosonfirst:country:85633779",
"country_a": "SVN",
"region": "Osrednjeslovenska",
"region_gid": "whosonfirst:region:1108959949",
"localadmin": "Ljubljana",
"localadmin_gid": "whosonfirst:localadmin:1108959501",
"locality": "Ljubljana",
"locality_gid": "whosonfirst:locality:101752073",
"label": "Lekarna Vič, Ljubljana, Slovenija",
"addendum": {
"osm": {
"operator": "Lekarna Ljubljana",
"website": "https://www.zd-lj.si/zdlj/",
"opening_hours": "Mo-Fr 07:15-19:15; Sa 08:00-13:00"
}
}
},
"bbox": [
14.4867112,
46.0466713,
14.4869358,
46.0468412
]
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
14.514894,
46.056649
]
},
"properties": {
"id": "node/1978710158",
"gid": "openstreetmap:venue:node/1978710158",
"layer": "venue",
"source": "openstreetmap",
"source_id": "node/1978710158",
"name": "Lekarna Metelkova",
"housenumber": "9",
"street": "Metelkova ulica",
"postalcode": "1000",
"confidence": 1,
"match_type": "exact",
"accuracy": "point",
"country": "Slovenija",
"country_gid": "whosonfirst:country:85633779",
"country_a": "SVN",
"region": "Osrednjeslovenska",
"region_gid": "whosonfirst:region:1108959949",
"localadmin": "Ljubljana",
"localadmin_gid": "whosonfirst:localadmin:1108959501",
"locality": "Ljubljana",
"locality_gid": "whosonfirst:locality:101752073",
"label": "Lekarna Metelkova, Ljubljana, Slovenija",
"addendum": {
"osm": {
"wheelchair": "yes",
"operator": "Lekarna Ljubljana",
"opening_hours": "Mo-Fr 07:00-19:30; Sa 08:00-19:00"
}
}
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
14.507316,
46.061576
]
},
"properties": {
"id": "node/443419947",
"gid": "openstreetmap:venue:node/443419947",
"layer": "venue",
"source": "openstreetmap",
"source_id": "node/443419947",
"name": "Lekarna Bežigrad",
"housenumber": "23",
"street": "Dunajska cesta",
"postalcode": "1000",
"confidence": 1,
"match_type": "exact",
"accuracy": "point",
"country": "Slovenija",
"country_gid": "whosonfirst:country:85633779",
"country_a": "SVN",
"region": "Osrednjeslovenska",
"region_gid": "whosonfirst:region:1108959949",
"localadmin": "Ljubljana",
"localadmin_gid": "whosonfirst:localadmin:1108959501",
"locality": "Ljubljana",
"locality_gid": "whosonfirst:locality:101752073",
"label": "Lekarna Bežigrad, Ljubljana, Slovenija",
"addendum": {
"osm": {
"wheelchair": "yes",
"operator": "Lekarna Ljubljana",
"opening_hours": "Mo-Fr 08:00-19:00; Sa 08:00-13:00"
}
}
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
14.536686,
46.021813
]
},
"properties": {
"id": "node/2074606644",
"gid": "openstreetmap:venue:node/2074606644",
"layer": "venue",
"source": "openstreetmap",
"source_id": "node/2074606644",
"name": "Lekarna Supernova",
"confidence": 1,
"match_type": "exact",
"accuracy": "point",
"country": "Slovenija",
"country_gid": "whosonfirst:country:85633779",
"country_a": "SVN",
"region": "Osrednjeslovenska",
"region_gid": "whosonfirst:region:1108959949",
"localadmin": "Ljubljana",
"localadmin_gid": "whosonfirst:localadmin:1108959501",
"locality": "Ljubljana",
"locality_gid": "whosonfirst:locality:101752073",
"label": "Lekarna Supernova, Ljubljana, Slovenija",
"addendum": {
"osm": {
"operator": "Lekarna Ljubljana",
"opening_hours": "Mo-Fr 09:00-21:00; Sa 08:00-21:00"
}
}
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
14.493308,
46.065358
]
},
"properties": {
"id": "node/2074606646",
"gid": "openstreetmap:venue:node/2074606646",
"layer": "venue",
"source": "openstreetmap",
"source_id": "node/2074606646",
"name": "Lekarna Šiška",
"housenumber": "83",
"street": "Celovška cesta",
"postalcode": "1000",
"confidence": 1,
"match_type": "exact",
"accuracy": "point",
"country": "Slovenija",
"country_gid": "whosonfirst:country:85633779",
"country_a": "SVN",
"region": "Osrednjeslovenska",
"region_gid": "whosonfirst:region:1108959949",
"localadmin": "Ljubljana",
"localadmin_gid": "whosonfirst:localadmin:1108959501",
"locality": "Ljubljana",
"locality_gid": "whosonfirst:locality:101752073",
"label": "Lekarna Šiška, Ljubljana, Slovenija",
"addendum": {
"osm": {
"operator": "Lekarna Ljubljana",
"opening_hours": "Mo-Fr 07:30-19:30; Sa 08:00-13:00"
}
}
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
14.507489,
46.054779
]
},
"properties": {
"id": "node/1894570012",
"gid": "openstreetmap:venue:node/1894570012",
"layer": "venue",
"source": "openstreetmap",
"source_id": "node/1894570012",
"name": "Lekarna Miklošič",
"housenumber": "24",
"street": "Miklošičeva cesta",
"postalcode": "1000",
"confidence": 1,
"match_type": "exact",
"accuracy": "point",
"country": "Slovenija",
"country_gid": "whosonfirst:country:85633779",
"country_a": "SVN",
"region": "Osrednjeslovenska",
"region_gid": "whosonfirst:region:1108959949",
"localadmin": "Ljubljana",
"localadmin_gid": "whosonfirst:localadmin:1108959501",
"locality": "Ljubljana",
"locality_gid": "whosonfirst:locality:101752073",
"label": "Lekarna Miklošič, Ljubljana, Slovenija",
"addendum": {
"osm": {
"wheelchair": "yes",
"operator": "Lekarna Ljubljana",
"opening_hours": "Mo-Fr 07:30-19:30; Sa 07:30-13:00"
}
}
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
14.50655,
46.051473
]
},
"properties": {
"id": "node/38832224",
"gid": "openstreetmap:venue:node/38832224",
"layer": "venue",
"source": "openstreetmap",
"source_id": "node/38832224",
"name": "Centralna lekarna",
"housenumber": "5",
"street": "Prešernov trg",
"postalcode": "1000",
"confidence": 1,
"match_type": "exact",
"accuracy": "point",
"country": "Slovenija",
"country_gid": "whosonfirst:country:85633779",
"country_a": "SVN",
"region": "Osrednjeslovenska",
"region_gid": "whosonfirst:region:1108959949",
"localadmin": "Ljubljana",
"localadmin_gid": "whosonfirst:localadmin:1108959501",
"locality": "Ljubljana",
"locality_gid": "whosonfirst:locality:101752073",
"label": "Centralna lekarna, Ljubljana, Slovenija",
"addendum": {
"osm": {
"wheelchair": "no",
"operator": "Lekarna Ljubljana",
"opening_hours": "Mo-Fr 07:30-19:30; Sa 08:00-15:00"
}
}
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
14.53173,
46.103442
]
},
"properties": {
"id": "node/1275756816",
"gid": "openstreetmap:venue:node/1275756816",
"layer": "venue",
"source": "openstreetmap",
"source_id": "node/1275756816",
"name": "Lekarna Črnuče",
"housenumber": "2",
"street": "Primožičeva ulica",
"postalcode": "1231",
"confidence": 1,
"match_type": "exact",
"accuracy": "point",
"country": "Slovenija",
"country_gid": "whosonfirst:country:85633779",
"country_a": "SVN",
"region": "Osrednjeslovenska",
"region_gid": "whosonfirst:region:1108959949",
"localadmin": "Ljubljana",
"localadmin_gid": "whosonfirst:localadmin:1108959501",
"locality": "Ljubljana",
"locality_gid": "whosonfirst:locality:101752073",
"label": "Lekarna Črnuče, Ljubljana, Slovenija",
"addendum": {
"osm": {
"operator": "Lekarna Ljubljana",
"opening_hours": "Mo-Fr 07:15-19:15; Sa 08:00-13:00"
}
}
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
14.545574,
46.067822
]
},
"properties": {
"id": "node/2083632731",
"gid": "openstreetmap:venue:node/2083632731",
"layer": "venue",
"source": "openstreetmap",
"source_id": "node/2083632731",
"name": "Lekarna Citypark",
"housenumber": "152g",
"street": "Trg mladih",
"postalcode": "1000",
"confidence": 1,
"match_type": "exact",
"accuracy": "point",
"country": "Slovenija",
"country_gid": "whosonfirst:country:85633779",
"country_a": "SVN",
"region": "Osrednjeslovenska",
"region_gid": "whosonfirst:region:1108959949",
"localadmin": "Ljubljana",
"localadmin_gid": "whosonfirst:localadmin:1108959501",
"locality": "Ljubljana",
"locality_gid": "whosonfirst:locality:101752073",
"label": "Lekarna Citypark, Ljubljana, Slovenija",
"addendum": {
"osm": {
"operator": "Lekarna Ljubljana",
"opening_hours": "Mo-Fr 09:00-21:00; Sa 08:00-21:00"
}
}
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
14.523422,
46.066428
]
},
"properties": {
"id": "node/2083440509",
"gid": "openstreetmap:venue:node/2083440509",
"layer": "venue",
"source": "openstreetmap",
"source_id": "node/2083440509",
"name": "Lekarna Soča",
"housenumber": "51",
"street": "Linhartova cesta",
"postalcode": "1000",
"confidence": 1,
"match_type": "exact",
"accuracy": "point",
"country": "Slovenija",
"country_gid": "whosonfirst:country:85633779",
"country_a": "SVN",
"region": "Osrednjeslovenska",
"region_gid": "whosonfirst:region:1108959949",
"localadmin": "Ljubljana",
"localadmin_gid": "whosonfirst:localadmin:1108959501",
"locality": "Ljubljana",
"locality_gid": "whosonfirst:locality:101752073",
"label": "Lekarna Soča, Ljubljana, Slovenija",
"addendum": {
"osm": {
"wheelchair": "yes",
"opening_hours": "Mo-Fr 07:30-19:30"
}
}
}
}
],
"bbox": [
14.4867112,
46.021813,
14.545574,
46.103442
]
}
Additional context
All default. Running in Docker.
References
I don't think so, I haven't found any related issues.
I'm sorry if my explanation is a bit vague and empty. I'll explain more in-depth if requested.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Pelias API search endpoint and reproduce the request using the OpenStreetMap source, Slovenian language, and the provided text. Trace how the parsed street field affects confidence scoring; done means node/1894570012 or Lekarna Miklošič receives a higher confidence score and ranks above the other pharmacies.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, search
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100