pelias / pelias/api

Changed search behaviour with an empty ?categories parameter

Open
#1,374 4 comments 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

Hey team!

I found this rather strange issue where I was sending an empty categories= parameter by default. Normally this works perfectly and doesn't seem to change the search results.

https://pelias.github.io/compare/#/v1/search%3Fcategories=&boundary.country=AU&layers=locality&size=1&text=crows+nest%252C+nsw
"Gnows Nest, WA" is obviously not "Crows Nest, NSW".

Removing the empty ?categories and it works perfectly as expected:
https://pelias.github.io/compare/#/v1/search%3Fboundary.country=AU&layers=locality&size=1&text=crows+nest%252C+nsw

It's an easy fix on my side but I can't figure out the mechanism which produces this behaviour, surely this is a bug?

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

Use the two linked Pelias compare requests as the reproduction, focusing on the difference between an empty categories parameter and omitting it. Start at the search API's handling of query parameters and trace how the empty value affects the Crows Nest, NSW request. Done means both requests produce equivalent results for the supplied example, with regression coverage for this behavior.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.