Cache-friendly viewbox alternative
Opened this issue · 1 comments
We would need to come up with a client calculation of location in a geographical grid which would be attached to the query.
Server would boost the requests for names within the same grid cell - so in first 25 results are for sure the relevant one.
Client would could further refine the order of the 25 results by knowing the actual location and zoom level of the map exactly, and by calculating distance to the candidate lat/long.
Partly related is GeoHash: https://en.wikipedia.org/wiki/Geohash
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-geohashgrid-aggregation.html
We could also just define fixed number of geographic regions / locations - and either attach none (for zoomed up map) or exactly one of them (for zoomed in map) by the client.
The number of the all possible hashes multiplies the size of cache required.
An alternative to this is to increase the list of returned candidates (this can be cached well on CDN) and do only the client side reordering - but then we have no guarantee the street / place name closest to the viewport is in the list in fact.