pelias / pelias/api

Search and autocomplete focus.point queries have different scale

Open
#1,206 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

The scale parameter to our center_point calculations used when users pass a focus.point parameter differs on search and autocomplete:

  • for search, it's 50km
  • for autocomplete, it's 250km.

Both changes date back to 2015, and there's no immediately obvious reason why they are at those particular values, let alone different values.

Relevant Elasticsearch documentation: The Closer, The Better

Additionally, we should consider carefully if the linear decay function is what we want. As it stands, no focus boosting is applied to results at a distance over 2x the scale parameter, so 100km for search, and 500km for autocomplete.

It might make sense to switch to the exponential decay function, which would allow even very far away results to be compared by distance. A particularly relevant use case here is for postal codes. There are often duplicate postal codes in different places of the world, so even a slight score difference based on distance would allow us to properly order postal code results from different countries.

Also worth noting, this may have overlap with #1205

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 with query/search_defaults.js and query/autocomplete_defaults.js, where the differing focus.point scales are defined, then review the linked Elasticsearch decay-function documentation. Compare the search and autocomplete behavior, including duplicate postal-code results, and clarify the intended scales and decay function before defining the completed change.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.