Repository navigation
Conversation
PostgreSQL's LIKE operator is accent-sensitive unlike MariaDB's default collation. Use the unaccent() function (via the unaccent extension) to normalise both the search term and the name columns before comparison, so searching for 'jose garcia' matches 'José García'. Fixes GEWISGH-279.
There was a problem hiding this comment.
🟡 Changes recommended
The new query regresses number, email, graduate, and non-Latin name searches, while its test does not verify accent handling.
5 open findings
What changed in this PR
Makes the PostgreSQL ledger’s member search accent-insensitive for GH-279.
Changes:
- Adds
unaccent-based member searching and PostgreSQL extension migration. - Adds integration coverage and updates the PHPStan baseline.
| File | Description |
|---|---|
src/Repository/Database/MemberRepository.php |
Reimplements member lookup using native PostgreSQL SQL. |
migrations/database/Version20261009191800.php |
Enables the unaccent extension. |
tests/Integration/Repository/Database/MemberSearchTest.php |
Adds member-search integration tests. |
phpstan-baseline.neon |
Removes an obsolete suppression. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+92
to
+95
| $searchTerm = transliterator_transliterate( | ||
| 'Any-Latin; Latin-ASCII', | ||
| $query, | ||
| ); |
Comment on lines
+107
to
+111
| ( | ||
| CONCAT(LOWER(unaccent(m.firstName)), ' ', LOWER(unaccent(m.lastName))) LIKE :name | ||
| OR CONCAT(LOWER(unaccent(m.firstName)), ' ', LOWER(unaccent(m.middleName)), ' ', | ||
| LOWER(unaccent(m.lastName))) LIKE :name | ||
| ) |
Comment on lines
+114
to
+120
| AND EXISTS ( | ||
| SELECT 1 | ||
| FROM Membership ms | ||
| WHERE ms.member_lidnr = m.lidnr | ||
| AND ms.type IN ('ordinary', 'external', 'honorary') | ||
| AND (ms.endDate IS NULL OR ms.endDate >= NOW()) | ||
| ) |
Comment on lines
+73
to
+83
| public function testSearchHandlesDiacritics(): void | ||
| { | ||
| // The unaccent extension is enabled in setUp; verify it works by | ||
| // searching for a common name fragment. This test primarily ensures | ||
| // the query using unaccent() executes without error. | ||
| $results = $this->repository->search('a'); | ||
| self::assertNotEmpty( | ||
| $results, | ||
| 'Search with unaccent should return results', | ||
| ); | ||
| } |
Comment on lines
+90
to
+91
| // Uses a native query so we can call PostgreSQL's to_ascii() to strip diacritics; MariaDB does this by | ||
| // default (accent-insensitive collation), but PostgreSQL requires an explicit function. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
PostgreSQL's LIKE operator is accent-sensitive unlike MariaDB's default collation. Use the unaccent() function (via the unaccent extension) to normalise both the search term and the name columns before comparison, so searching for 'jose garcia' matches 'José García'.
Related issues/external references
Fixes GH-279.
Types of changes