fix(search): open tasks and list items before completed ones
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 2m36s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
sandrodachandClaude Opus 5.5 committed 2026-11-01 18:36:45 +01:00
1 parent 2bb0dec744
commit 558fc46cf4
6 files changed
+38 -7

No files matched your search

+3 -2
View File
@@ -273,7 +273,8 @@ func (s *Store) SearchGlobal(userID, query string) (*SearchResults, error) {
JOIN thoughts t ON t.id = f.thought_id
WHERE thoughts_fts MATCH ?
AND (t.user_id = ? OR t.task_list_id IN (`+s.accessibleTaskListIDsQuery()+`))
ORDER BY score ASC
-- Open before completed, discarded thoughts last; within each by relevance
ORDER BY t.status = 'discarded' ASC, t.is_completed ASC, score ASC
LIMIT 40
`, ftsQuery, userID, userID, userID, userID)
if err == nil {
@@ -330,7 +331,7 @@ func (s *Store) SearchGlobal(userID, query string) (*SearchResults, error) {
FROM list_items_fts f
JOIN list_items li ON li.id = f.item_id
WHERE list_items_fts MATCH ?
ORDER BY score ASC
ORDER BY li.is_completed ASC, score ASC
LIMIT 40
`, ftsQuery)
if err == nil {