pelias / pelias/api

autocomplete: rectangle, circle or country focus

Open
#1,516 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
259
Forks
168
Avg merge
6h 15m
Merged PRs (30d)
1

Description

Use-cases

Very simple. I would like to perform autocomplete requests with a focus on a country, bbox or circle with radius without completely ruling out places that are not contained by one of these.

Most users are interested in results inside of their own country but still try out bigger cities/specific addresses in other countries. Usually while specifying the ISO 2/3 country code in the search bar as well.

Attempted Solutions

Right now, I add a focuspoint to try to achieve this requirement. But I'm not satisfied with the results. Small venues/localities close to the specified focuspoint receive precedence over much bigger venues/localities that are more in the outskirts of the country.

For instance:
I live in Belgium and use a focuspoint close to the center of Brussels. If I try to autocomplete 'Ledeberg', there is a hamlet called Ledeberg with a population of 1500 which is much closer to Brussels than the much larger village Ledeberg with a population of 8300.

-> With a focuspoint: the smallest Ledeberg is the top result
-> Without a Focuspoint, the largest Ledeberg is the top result

https://spelunker.whosonfirst.org/id/101755495/ vs
https://spelunker.whosonfirst.org/id/1260110643/

/v1/autocomplete?text=ledeberg&size=5&focus.point.lat=50.813017&focus.point.lon=4.301934 vs
/v1/autocomplete?text=ledeberg&size=5

Proposal

I'm not 100% familiar with the scoring algorithm but it seems not too hard to prioritize results inside a given country/bbox/circle since the functionality of filtering results in a given country/bbox/circle is already there. Although forgive me if I'm wrong about this!

References

None that I'm aware of.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the /v1/autocomplete endpoint and the existing country, bbox, and circle filtering behavior mentioned in the issue. Compare the Ledeberg examples and inspect how scoring handles focus points; done means in-area results are prioritized without excluding relevant out-of-area results.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, search
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.