feat(search): kind chips, large view with filters and context, tick tasks and list items right in the results
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 2m37s
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 2m37s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
558fc46cf4
commit
994f6dc554
12 files changed
+522
-40
No files matched your search
@@ -236,3 +236,38 @@ func TestSearchListsOpenTasksFirst(t *testing.T) {
|
||||
t.Fatalf("open task should come first: %v (open %s, done %s)", order, open.ID, done)
|
||||
}
|
||||
}
|
||||
|
||||
// Narrowing by kind and filters: tasks of one status, list items of one list, notes in a folder.
|
||||
func TestSearchOptions(t *testing.T) {
|
||||
store, userA, _ := setupTestStore(t)
|
||||
defer store.Close()
|
||||
|
||||
doc, _ := store.CreateDocument(userA.ID, "", "Garten", "", "Haus", nil, nil, false)
|
||||
_, _ = store.CreateDocument(userA.ID, "", "Garten Büro", "", "Arbeit", nil, nil, false)
|
||||
done := doneTask(t, store, userA.ID, "", "Garten winterfest machen", "")
|
||||
open, _ := store.CreateThoughtWithDetails(userA.ID, "Garten Hecke schneiden", "high", "manual", "", "", "todo", "")
|
||||
_, _ = store.UpdateThoughtTriage(userA.ID, open.ID, "keep", "task", "", "", "")
|
||||
lst, _ := store.CreateList(userA.ID, "Baumarkt", "", "shopping")
|
||||
_, _ = store.CreateListItem(lst.ID, "Gartenschere", "", "", 0, userA.ID)
|
||||
|
||||
only, err := store.Search(userA.ID, "Garten", SearchOptions{Type: "thought"})
|
||||
if err != nil || len(only.Hits) != 2 || only.Counts["document"] != 0 {
|
||||
t.Fatalf("type filter: %+v %v", only.Counts, err)
|
||||
}
|
||||
openOnly, _ := store.Search(userA.ID, "Garten", SearchOptions{Type: "thought", TaskStatus: "open"})
|
||||
if len(openOnly.Hits) != 1 || openOnly.Hits[0].ID != open.ID {
|
||||
t.Fatalf("open tasks only: %+v", openOnly.Hits)
|
||||
}
|
||||
doneOnly, _ := store.Search(userA.ID, "Garten", SearchOptions{Type: "thought", TaskStatus: "done", Priority: "normal"})
|
||||
if len(doneOnly.Hits) != 1 || doneOnly.Hits[0].ID != done {
|
||||
t.Fatalf("done + priority: %+v", doneOnly.Hits)
|
||||
}
|
||||
inFolder, _ := store.Search(userA.ID, "Garten", SearchOptions{Type: "document", Folder: "Haus"})
|
||||
if len(inFolder.Hits) != 1 || inFolder.Hits[0].DocID != doc.ID {
|
||||
t.Fatalf("folder filter: %+v", inFolder.Hits)
|
||||
}
|
||||
all, _ := store.Search(userA.ID, "Garten", SearchOptions{})
|
||||
if all.Counts["thought"] != 2 || all.Counts["document"] != 2 {
|
||||
t.Fatalf("counts: %+v", all.Counts)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user