feat: search users by display name - #27398
Merged
Merged
Conversation
Docs preview📖 View docs preview for |
Free-text member search previously matched only username and email. Broaden the @search filter in GetUsers, PaginatedOrganizationMembers, and GetGroupMembersByGroupIDPaginated to also match the user's display name (users.name). This covers the Users, Organization Members, and Group Members pages, plus the server-filtered user pickers. Add display name to the client-filtered MemberAutocomplete keywords so the organization member picker matches display name locally. Refs DEVEX-484 Refs DEVEX-565
aqandrew
force-pushed
the
feat/search-members-by-display-name
branch
from
July 21, 2026 19:10
f561e9c to
2877168
Compare
aqandrew
marked this pull request as ready for review
July 21, 2026 19:44
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Free-text member search previously matched only username and email, so typing a person's display name returned no results even though the UI shows the display name as the primary label. This broadens the free-text
@searchfilter to also matchusers.name.The change is in three queries:
GetUsers,PaginatedOrganizationMembers, andGetGroupMembersByGroupIDPaginated. This covers every server-filtered surface: the Users page, the Organization Members page, the Group Members page, and theUserAutocomplete/WorkspaceUserAutocompletepickers (which queryGetUserswithq). The org member picker (MemberAutocomplete) filters client-side via cmdk, so display name is added to itskeywords.Explicit filters (
name:,username/email) and pagination counts are unchanged; the group members count still comes from the filteredCOUNT(*) OVER()in the same query.Refs DEVEX-484
Refs DEVEX-565
Implementation plan
Problem
Member search (both the global Users page and the Organization Members page) matches only on
usernameandemail. It does not match on the user's display name (users.name), even though the Organization Members table showsnameas the primary title. So typing a person's full name in the search box returns nothing.Today a bare search term (
alice) is routed to the SQL@searchfilter, which only checksemail/username. Display name is only matched if the user explicitly typesname:alice, which is undiscoverable.Design decision
Include
namein the free-text@searchcondition in the affected SQL queries. A bare term then matchesemail OR username OR name, using the same case-insensitive substringILIKEalready in place. This keeps the existing explicitname:filter working.Tradeoff: this broadens the meaning of free-text
searchglobally (anything using these queries now also matches display name). This is the intended behavior, confirmed against DEVEX-565 (display name search in the user picker).Affected files
Backend:
coderd/database/queries/users.sql(GetUsers)coderd/database/queries/organizationmembers.sql(PaginatedOrganizationMembers)coderd/database/queries/groupmembers.sql(GetGroupMembersByGroupIDPaginated)coderd/database/queries.sql.goregenerated viamake genFrontend:
site/src/components/UserAutocomplete/UserAutocomplete.tsx(addnameto client-side cmdk keywords)Tests:
coderd/coderdtest/users.go(sharedUsersFilterhelper): added aDisplayNameSearchcase and extended search-based expectations to includename. Exercised byTestGetUsersFilter,TestGetOrgMembersFilter, andTestGetGroupMembersFilter.Docs:
docs/admin/users/index.md: documented that free-text search matches username, email, and display name.Frontend surface coverage
qGET /usersGetUsersqPaginatedOrganizationMembersqgroupMembersGetGroupMembersByGroupIDPaginatedqGET /usersGetUsersOut of scope
ILIKEsubstring semantics.LOWER(username)).Created by Coder Agents on behalf of @aqandrew.