Users finder should sort on fuzzy match
Problem to solve
Found while working on !38701 (merged)
The users finder sort uses direct comparison and does not lowercase the query
in the ORDER BY clause statement.
The sorting could have complete or partially matched items sorted lower than they could be.
order = <<~SQL
CASE
WHEN users.name = :query THEN 0
WHEN users.username = :query THEN 1
WHEN users.email = :query THEN 2
ELSE 3
END
SQL
Intended users
Anyone who searches for users using the search in navigation bar or search form.
User experience goal
Partially matching name, username, or email should come up before any data
Proposal
Modify the case statement in the ORDER BY clause to
- add sort priority using a fuzzy match for
name
andusername
so it matches how the search is performed - lowercase the query in the case statement for all comparisons
Further details
Permissions and Security
Documentation
Availability & Testing
- Unit test changes