Search
Wirechat has two search surfaces:
| Search | What it finds | Configure with |
|---|---|---|
| Conversation search | Existing conversations in the chat list | chatsSearch() |
| User search | People who can be selected for chats, groups, members, and invite sharing | searchableAttributes() or searchUsersUsing() |
These searches solve different jobs. Conversation search helps users find an existing thread. User search controls which application users can appear before someone starts a new conversation or adds people to group-related flows.
Conversation Search
Enable the chat-list search field from the panel:
use Wirechat\Wirechat\Panel;
public function panel(Panel $panel): Panel
{
return $panel
->chatsSearch();
}
Disable it by passing false:
->chatsSearch(false)
See Panels for the full panel option.
User Search
User search uses your application's configured user model. It appears anywhere Wirechat needs the user to select another person:
- Starting a new private chat.
- Creating a group and selecting initial members.
- Adding members to an existing group.
- Sharing a group invite link with users.
Configure searchable attributes when the default query is enough:
->searchableAttributes(['name', 'email', 'username'])
For custom eligibility rules, use searchUsersUsing() from your panel provider:
->searchUsersUsing(function (string $needle) {
// Return WirechatUserResource results.
})
Use the custom callback when search results need application-level rules such as tenant membership, account status, roles, blocking, or moderation state. Wirechat still enforces group-add privacy and canSendMessageTo() before final actions, but filtering early keeps users from seeing results they cannot use.
See Users for the full custom search example.
Encrypted Messages
Wirechat does not provide message body search. When message encryption is enabled, stored message bodies cannot be queried with database LIKE searches.
Use a separate indexing strategy for custom message search. See Encryption.