Search results (, ) were sorted by FTS5 relevance rank () instead of date, so results appeared in a seemingly random order instead of newest-first.
After merging FTS results with note-search results the combined list was also never re-sorted.
Changes
Changed ORDER BY rank → ORDER BY e.received_at DESC in both FTS queries so the database already returns the 50 most recent matches.
Added merged.sort((a, b) => b.receivedAt.compareTo(a.receivedAt)) after merging FTS + note results so the combined list is always newest-first, consistent with the normal email list view.
Added two unit tests verifying sort order for searchEmailsGlobal and searchEmails.
Test plan
New unit tests: searchEmailsGlobal returns results sorted by receivedAt descending
New unit tests: searchEmails returns results sorted by receivedAt descending
Existing search tests continue to pass (filter/scope behaviour unchanged)
## Summary
- Search results (, ) were sorted by FTS5 relevance rank () instead of date, so results appeared in a seemingly random order instead of newest-first.
- After merging FTS results with note-search results the combined list was also never re-sorted.
## Changes
- Changed `ORDER BY rank` → `ORDER BY e.received_at DESC` in both FTS queries so the database already returns the 50 most recent matches.
- Added `merged.sort((a, b) => b.receivedAt.compareTo(a.receivedAt))` after merging FTS + note results so the combined list is always newest-first, consistent with the normal email list view.
- Added two unit tests verifying sort order for `searchEmailsGlobal` and `searchEmails`.
## Test plan
- [x] New unit tests: `searchEmailsGlobal returns results sorted by receivedAt descending`
- [x] New unit tests: `searchEmails returns results sorted by receivedAt descending`
- [x] Existing search tests continue to pass (filter/scope behaviour unchanged)
Closes #509
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Changes
ORDER BY rank→ORDER BY e.received_at DESCin both FTS queries so the database already returns the 50 most recent matches.merged.sort((a, b) => b.receivedAt.compareTo(a.receivedAt))after merging FTS + note results so the combined list is always newest-first, consistent with the normal email list view.searchEmailsGlobalandsearchEmails.Test plan
searchEmailsGlobal returns results sorted by receivedAt descendingsearchEmails returns results sorted by receivedAt descendingCloses #509