Skip to content

[2.x] fix: make user search case-insensitive across all supported databases#4467

Merged
imorland merged 1 commit into2.xfrom
im/case-insensitive-user-search
Mar 16, 2026
Merged

[2.x] fix: make user search case-insensitive across all supported databases#4467
imorland merged 1 commit into2.xfrom
im/case-insensitive-user-search

Conversation

@imorland
Copy link
Member

Summary

  • PostgreSQL's LIKE operator is case-sensitive, causing user search on the /users page (and mention autocomplete) to miss results that differ only in case
  • FulltextFilter now uses ILIKE on PostgreSQL, LOWER(username) LIKE on SQLite, and unchanged LIKE on MySQL/MariaDB (already case-insensitive via collation)
  • UserRepository::getIdsForUsername receives the same treatment, including its prefix-match ORDER BY clauses
  • Follows the same per-driver match() pattern already used in Discussion\Search\FulltextFilter

Test plan

  • Search for a user by uppercase username on a PostgreSQL install — should return results
  • Same test on MySQL — results unchanged
  • Same test on SQLite — results unchanged
  • Mention autocomplete (@Username with wrong case) works on PostgreSQL

MySQL/MariaDB already handles this via collation (LIKE), PostgreSQL now
uses ILIKE, and SQLite uses LOWER(username) LIKE since its LIKE is only
ASCII case-insensitive. Applies to both FulltextFilter (API/user directory
search) and UserRepository::getIdsForUsername (mention autocomplete etc).
@imorland imorland requested a review from a team as a code owner March 16, 2026 21:25
@imorland imorland changed the title fix: make user search case-insensitive across all supported databases [2.x] fix: make user search case-insensitive across all supported databases Mar 16, 2026
@imorland imorland added this to the 2.0.0-beta.8 milestone Mar 16, 2026
@imorland imorland merged commit 747ce1a into 2.x Mar 16, 2026
27 checks passed
@imorland imorland deleted the im/case-insensitive-user-search branch March 16, 2026 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant