pelias / pelias/api

search: interpolation results included for layers=-address

Open
#1,673 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

When interpolations are generated, they are always of type address, however it's possible for the API to return these results even when the layers are specified in a way that excludes the address layer.

For example: https://pelias.github.io/compare/#/v1/search?layers=street&text=10+Brunswick+Street%2C+VIC

In this case the query specifically requested layers=street yet the result set contains rows from the address layer.

Screenshot 2024-03-28 at 11 52 04

The cause of this issue is in the interpolationShouldExecute predicate, which should take into account the requested layers and not execute if the address layer is not targeted:

https://github.com/pelias/api/blob/e6f532b18577c8436a10651c07e5a2e9f5fdb1ea/routes/v1.js#L182-L187

Note: this should also improve performance for these queries.

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

Open routes/v1.js around the interpolationShouldExecute predicate and reproduce the linked search request with layers=street. Update the predicate behavior so interpolation results do not appear when address is excluded, while address-targeting requests continue to work. Verify both cases using the API search example.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, search
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.