Expand description
Pure filtering, grouping and counting for task queries.
Everything here is a function of its arguments: no clock, no filesystem, no
shared state. run_query takes a snapshot of FileTasks (from
crate::task_index::TaskIndex::snapshot) plus the day to treat as “today”
and returns the whole response body. The axum handler is a thin wrapper, the
same split SearchEngine::search / search_handler uses.
§Counting rules
The two display modes count very differently, and the difference is the whole reason grouping lives on the server:
| Mode | Group | total counts | done counts |
|---|---|---|---|
| Category | one per file | every task in the file, filters ignored | its Done ones |
| Calendar | one per due bucket | tasks matching everything except status | its Done ones |
Canceled tasks never count toward a total in either mode. In calendar mode they are dropped outright — they cannot appear, be counted, or create a bucket — because a canceled task has no meaningful due date.
Incomplete markers (crate::tasks::TaskKind::Marker) are category-mode
only, dropped in calendar mode by the same rule and for a stronger reason:
they can never carry a due date. They are real matches everywhere else —
total_matches and the folder facets count them — but never move a note’s
done/total, which FileTasks derives from checkboxes alone.
limit truncates the tasks that are returned; it never affects a count.
total_matches is the pre-truncation number of matching tasks.
Structs§
- Folder
Facet - A folder and the number of matching tasks at or below it.
- Query
Terms - The text filter, split into plain words and
#tagtokens. - Task
Group - One heading in the results list, with its tasks and progress numbers.
- TaskHit
- One task in a response: every
Taskfield, plus where it lives. - Task
Query - A task query, as posted to
/.mbr/tasks. - Task
Query Response - The
/.mbr/tasksresponse body.
Enums§
- DueBucket
- Which calendar heading a task falls under.
- DueFilter
- Due-date filter. Mirrors
DueBucketso the filter and the calendar headings can never disagree about what “tomorrow” means. - Include
Filter - Which kinds of entry a query wants back.
- Task
Mode - How results are grouped.
Constants§
- DEFAULT_
TASK_ LIMIT - Default cap on returned tasks.
Functions§
- due_
bucket - Places a due datetime in its calendar bucket relative to
today. - normalize_
folder - Normalizes a folder filter to a
/-delimited prefix, orNonefor “everywhere”. - parse_
task_ query - Splits a filter string into words and tags.
- run_
query - Runs a task query over an index snapshot.