code4romania / code4romania/onghub

[NGOs listing] NGOs with special characters don't appear when searching with latin letters

Open
#355 2 comments 0 reactions 1 assignee Claimed by @radulescuandrew View on GitHub
back-end bug :bug: enhancement :rocket: future-version seen wontfix
Dominant language
TypeScript
Stars
6
Forks
5
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
When searching for NGOs in the listing, the only results that appear are the ones that exactly match the search string.

**Steps to reproduce the behavior**
1. Go to `/organizations` logged in as a `super-admin`
2. Search for an organization that has diacritics in its name without using diacritics
- i.e., for "Federația Marelui Orient..." search using the term "federatia"
4. Check the search results
5. The organization doesn't appear on the list

**Expected behavior**
An organization with the same core Latin letters should be searchable by those letters.
e.g. a -> [ă, â, à, á, ä, ã, å, ā]

**Additional context**
Since there will be international NGOs from different countries than the administrators, it would be difficult for the admins to find an NGO by name if they don't know the exact name.
I assume [localeCompare](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare) should be used in this context. I had to look into [an article on Medium](https://medium.com/thread-engineering/searching-and-sorting-text-with-diacritical-marks-in-javascript-45afef20e7f2) to find out this, so I might be wrong.

**Screenshots**
![Image showing the list results before searching for the organization. "Federația Marelui Orient Al României1" appears in the list](https://github.com/code4romania/onghub/assets/2820084/ad51ad4d-4519-4f16-a980-82c16751315f)
![Image showing the list results after searching for the "federa". "Federația Marelui Orient Al României1" appears in the list](https://github.com/code4romania/onghub/assets/2820084/9bcfcf70-ea05-463e-976c-3015dafe7cbf)
![Image showing the list results after searching for the "federat". "Federația Marelui Orient Al României1" no longer appears in the list](https://github.com/code4romania/onghub/assets/2820084/8b6c1107-6652-4a66-92af-8827eed2fb32)

**Device information**
- OS: MacOS 13.5.2
- Browser: Chrome 117.0.5938.92 [ARM]

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.