Police-Data-Accessibility-Project / data-sources-app

An API and UI for using and maintaining the Data Sources database
MIT License
2 stars 4 forks source link

v1 quicksearch string matching bug #346

Open josh-chamberlain opened 3 days ago

josh-chamberlain commented 3 days ago

Context

flagging this partly because it went unnoticed for so long—we should make sure we are not replicating things like this with new search: #249

Description

This is related to unexpected/missing search results in ways I don't quite understand.

Search 1: dashboard in allegheny county

Search 2: all in allegheny county jail

Search 3: dashboard in allegheny county jail

Requirements

EvilDrPurple commented 1 day ago

Can confirm this bug is still present in dev branch of v2 as well

EvilDrPurple commented 1 day ago

It seems the issue was with the .title() here:

cursor.execute(QUICK_SEARCH_SQL.format(search.title(), location.title()))

The function capitalizes the start of every word, causing some searches to slip through the cracks since they are case sensitive. Removing them fixed the outlined searches. I'm going to make it so that the search terms and the database terms are lowercased to solve any case-sensitivity issues in searches. That is assuming there was no foreseeable reason for it to have been set up this way in the first place

EvilDrPurple commented 1 day ago

PRs submitted for both v1 and v2