🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

feat: search users by display name - #27398

Merged
aqandrew merged 1 commit into
mainfrom
feat/search-members-by-display-name
Jul 28, 2026
Merged

feat: search users by display name#27398
aqandrew merged 1 commit into
mainfrom
feat/search-members-by-display-name

Conversation

@aqandrew

Copy link
Copy Markdown
Contributor

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 @search filter to also match users.name.

The change is in three queries: GetUsers, PaginatedOrganizationMembers, and GetGroupMembersByGroupIDPaginated. This covers every server-filtered surface: the Users page, the Organization Members page, the Group Members page, and the UserAutocomplete / WorkspaceUserAutocomplete pickers (which query GetUsers with q). The org member picker (MemberAutocomplete) filters client-side via cmdk, so display name is added to its keywords.

Explicit filters (name:, username/email) and pagination counts are unchanged; the group members count still comes from the filtered COUNT(*) 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 username and email. It does not match on the user's display name (users.name), even though the Organization Members table shows name as 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 @search filter, which only checks email/username. Display name is only matched if the user explicitly types name:alice, which is undiscoverable.

Design decision

Include name in the free-text @search condition in the affected SQL queries. A bare term then matches email OR username OR name, using the same case-insensitive substring ILIKE already in place. This keeps the existing explicit name: filter working.

Tradeoff: this broadens the meaning of free-text search globally (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.go regenerated via make gen

Frontend:

  • site/src/components/UserAutocomplete/UserAutocomplete.tsx (add name to client-side cmdk keywords)

Tests:

  • coderd/coderdtest/users.go (shared UsersFilter helper): added a DisplayNameSearch case and extended search-based expectations to include name. Exercised by TestGetUsersFilter, TestGetOrgMembersFilter, and TestGetGroupMembersFilter.

Docs:

  • docs/admin/users/index.md: documented that free-text search matches username, email, and display name.

Frontend surface coverage

Surface Sends Backend Query
Users page q GET /users GetUsers
Organization Members page q paginated members PaginatedOrganizationMembers
Group Members page q groupMembers GetGroupMembersByGroupIDPaginated
User pickers (server-filtered) q GET /users GetUsers
Org member picker (client-filtered) local cmdk n/a keyword change

Out of scope

  • Trigram/similarity (fuzzy) matching; keeps ILIKE substring semantics.
  • Sort/pagination ordering (still LOWER(username)).

Created by Coder Agents on behalf of @aqandrew.

@linear-code

linear-code Bot commented Jul 21, 2026

Copy link
Copy Markdown

DEVEX-484

DEVEX-565

@github-actions

Copy link
Copy Markdown

Docs preview

📖 View docs preview for docs/admin/users/index.md

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
aqandrew force-pushed the feat/search-members-by-display-name branch from f561e9c to 2877168 Compare July 21, 2026 19:10
@aqandrew aqandrew changed the title feat(coderd): match display name in member search feat: match display name in member search Jul 21, 2026
@aqandrew aqandrew changed the title feat: match display name in member search feat: search users by display name Jul 21, 2026
@aqandrew
aqandrew marked this pull request as ready for review July 21, 2026 19:44

@jeremyruppel jeremyruppel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@aqandrew
aqandrew merged commit 09a69e6 into main Jul 28, 2026
44 of 46 checks passed
@aqandrew
aqandrew deleted the feat/search-members-by-display-name branch July 28, 2026 19:14
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants