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
@@ -4,6 +4,8 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"net/http"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -397,10 +399,32 @@ func (s *Server) handlePurgeDiscarded(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// --- SEARCH & EXPORT ---
|
||||
|
||||
// handleSearch: GET /search?q= – everything, or narrowed by type (document|thought|list_item), limit
|
||||
// (hits per kind, up to 200) and filters: taskStatus, taskListId, priority, due (today|overdue|week),
|
||||
// folder, listId, itemStatus.
|
||||
func (s *Server) handleSearch(w http.ResponseWriter, r *http.Request) {
|
||||
userID := auth.GetUserID(r.Context())
|
||||
q := r.URL.Query().Get("q")
|
||||
res, err := s.store.SearchGlobal(userID, q)
|
||||
qs := r.URL.Query()
|
||||
q := qs.Get("q")
|
||||
opts := storage.SearchOptions{
|
||||
Type: qs.Get("type"),
|
||||
TaskStatus: qs.Get("taskStatus"),
|
||||
TaskListID: qs.Get("taskListId"),
|
||||
Priority: qs.Get("priority"),
|
||||
Due: qs.Get("due"),
|
||||
Today: time.Now().In(time.Local).Format("2006-01-02"),
|
||||
Folder: qs.Get("folder"),
|
||||
ListID: qs.Get("listId"),
|
||||
ItemStatus: qs.Get("itemStatus"),
|
||||
}
|
||||
if opts.Type != "" && !slices.Contains(storage.SearchTypes, opts.Type) {
|
||||
writeError(w, http.StatusBadRequest, "type: document, thought oder list_item")
|
||||
return
|
||||
}
|
||||
if n, err := strconv.Atoi(qs.Get("limit")); err == nil {
|
||||
opts.Limit = n
|
||||
}
|
||||
res, err := s.store.Search(userID, q, opts)
|
||||
if err != nil {
|
||||
writeError(w, http.StatusInternalServerError, err.Error())
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user