Commit d6de2dc
feat: session-grouped search with sort toggle and name matching (#210)
Supersedes #200.
## Summary
- **Session-grouped results**: FTS5 search returns one result per
session. The best-ranked matching message provides the snippet and
scroll target.
- **Relevance/Recency sort toggle**: two-button control above results.
Sort validated server-side before ORDER BY interpolation. Toggle visible
during loading and zero-results states.
- **Session name search**: matches `display_name` and `first_message`
via a UNION with LIKE/ILIKE. Name-only matches use `ordinal = -1`;
frontend navigates without scrolling.
- **is_system flag**: parsers tag system-injected user messages; search
excludes them via column check and prefix fallback.
- **Case-sensitive prefix matching**: `SystemPrefixSQL` uses `substr()`
instead of `LIKE` for consistent behavior across SQLite
(case-insensitive LIKE) and PostgreSQL.
- **PostgreSQL parity**: `pg serve` path updated with `DISTINCT ON`
grouping, `is_system` column, ILIKE name branch.
- **FTS5 dedup fix**: outer JOIN includes MATCH clause to prevent
segment-level row duplication.
- **Stable timestamp ordering**: `julianday()` in SQLite ORDER BY avoids
lexicographic misorderings from variable fractional-second precision.
## Test plan
- [ ] `make test` — Go unit tests pass
- [ ] `make test-postgres` — PG integration tests pass
- [ ] `cd frontend && npx vitest run` — frontend tests pass
- [ ] Manual: Cmd+K search, verify session-grouped results with
name/snippet/meta
- [ ] Manual: Relevance/Recency toggle reorders results
- [ ] Manual: search term only in session name, verify ordinal=-1
behavior
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Tom Maloney <tom@supermaloney.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent e512967 commit d6de2dc
File tree
33 files changed
+2723
-191
lines changed- cmd/agentsview
- frontend/src/lib
- api
- types
- components
- command-palette
- content
- stores
- utils
- internal
- db
- parser
- postgres
- server
33 files changed
+2723
-191
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
664 | 664 | | |
665 | 665 | | |
666 | 666 | | |
667 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
58 | 66 | | |
59 | 67 | | |
60 | 68 | | |
| |||
78 | 86 | | |
79 | 87 | | |
80 | 88 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| |||
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
219 | | - | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
220 | 222 | | |
221 | 223 | | |
222 | 224 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
591 | 591 | | |
592 | 592 | | |
593 | 593 | | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
594 | 604 | | |
595 | 605 | | |
596 | 606 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| 215 | + | |
215 | 216 | | |
216 | 217 | | |
217 | 218 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| |||
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
| 85 | + | |
| 86 | + | |
84 | 87 | | |
85 | | - | |
86 | | - | |
| 88 | + | |
87 | 89 | | |
88 | 90 | | |
89 | 91 | | |
| |||
Lines changed: 113 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
19 | 30 | | |
20 | 31 | | |
21 | 32 | | |
| |||
92 | 103 | | |
93 | 104 | | |
94 | 105 | | |
95 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
96 | 113 | | |
97 | 114 | | |
98 | 115 | | |
99 | 116 | | |
100 | 117 | | |
101 | | - | |
102 | 118 | | |
103 | 119 | | |
104 | 120 | | |
| |||
149 | 165 | | |
150 | 166 | | |
151 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
152 | 182 | | |
153 | 183 | | |
154 | 184 | | |
| |||
161 | 191 | | |
162 | 192 | | |
163 | 193 | | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
169 | 207 | | |
170 | 208 | | |
171 | | - | |
| 209 | + | |
172 | 210 | | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
173 | 221 | | |
174 | 222 | | |
175 | 223 | | |
| |||
183 | 231 | | |
184 | 232 | | |
185 | 233 | | |
186 | | - | |
187 | | - | |
| 234 | + | |
| 235 | + | |
188 | 236 | | |
189 | | - | |
| 237 | + | |
190 | 238 | | |
191 | 239 | | |
192 | 240 | | |
| |||
296 | 344 | | |
297 | 345 | | |
298 | 346 | | |
299 | | - | |
300 | | - | |
301 | | - | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
302 | 350 | | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
| 351 | + | |
| 352 | + | |
311 | 353 | | |
312 | 354 | | |
313 | | - | |
314 | | - | |
315 | | - | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
316 | 361 | | |
317 | 362 | | |
318 | | - | |
319 | | - | |
320 | | - | |
| 363 | + | |
321 | 364 | | |
322 | 365 | | |
323 | 366 | | |
| 367 | + | |
| 368 | + | |
324 | 369 | | |
325 | 370 | | |
326 | 371 | | |
| |||
336 | 381 | | |
337 | 382 | | |
338 | 383 | | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
339 | 423 | | |
0 commit comments