Search Quick Start - nself-org/nchat GitHub Wiki
pnpm installAdd to .env.local:
NEXT_PUBLIC_MEILISEARCH_URL=http://search.localhost:7700
MEILISEARCH_MASTER_KEY=nchat-search-dev-key-32-chars-longcd .backend
nself startcurl -X POST http://localhost:3000/api/search/initializepnpm devPress Cmd+K (Mac) or Ctrl+K (Windows/Linux) to open search.
project update
from:john
in:general
has:file
after:2024-01-01 before:2024-12-31
project update from:john in:general has:file
| Shortcut | Action |
|---|---|
| Cmd+K / Ctrl+K | Open search |
| Cmd+S / Ctrl+S | Save current search |
| Cmd+F / Ctrl+F | Toggle filters |
| Escape | Close search |
| Operator | Description | Example |
|---|---|---|
from:username |
Filter by sender | from:john |
in:channel |
Filter by channel | in:general |
has:link |
Messages with links | has:link |
has:file |
Messages with files | has:file |
has:image |
Messages with images | has:image |
before:date |
Before date | before:2024-01-01 |
after:date |
After date | after:2024-01-01 |
is:pinned |
Pinned messages | is:pinned |
is:starred |
Starred messages | is:starred |
Click tabs to filter by content type:
- All - Search everything
- Messages - Messages only
- Files - Files only
- Users - Users only
- Channels - Channels only
- Enter your query
- Press Cmd+S or Ctrl+S
- Enter a name
- Click OK
- Click "Saved" button
- Click on saved search
- Results appear instantly
Click "Filters" button for:
- Date Range - From/to dates
- Channels - Filter by channel IDs
- Users - Filter by user IDs
- Content Types - Has link/file/image
- Properties - Pinned/starred only
- Sort - By relevance or date
import { indexMessage } from '@/lib/search/indexer'
await indexMessage({
id: message.id,
content: message.content,
author_id: message.author_id,
author_name: message.author_name,
channel_id: message.channel_id,
channel_name: message.channel_name,
created_at: message.created_at,
has_link: /https?:\/\//.test(message.content),
has_file: false,
has_image: false,
is_pinned: false,
is_starred: false,
})pnpm tsx scripts/reindex-search.ts- Check if Cmd+K / Ctrl+K works
- Verify
useSearchKeyboardhook is added to layout
- Check if MeiliSearch is running:
cd .backend && nself status - Initialize indexes:
curl -X POST http://localhost:3000/api/search/initialize - Verify content is indexed:
curl http://search.localhost:7700/indexes/messages/stats
cd .backend
nself startlsof -i :7700
kill -9 <PID>- Full Documentation: Search-Implementation.md
- System Architecture: ../src/lib/search/README.md
- API Reference: ../src/app/api/search/route.ts
- Dependencies installed (
pnpm install) - Environment configured (
.env.local) - Backend running (
cd .backend && nself status) - MeiliSearch healthy (
curl http://search.localhost:7700/health) - Indexes initialized (
curl -X POST http://localhost:3000/api/search/initialize) - Dev server running (
pnpm dev) - Search modal opens (Cmd+K)
- Search returns results
Press Cmd+K and start searching!
For questions or issues, see: