-
Notifications
You must be signed in to change notification settings - Fork 7
Feature request: Aggregate + grouping support in Query Builder (count tags per block) #312
Copy link
Copy link
Open
Description
Summary
Add support in Query Builder for aggregation (e.g. count) and grouping so users can surface blocks with the highest number of tags / page refs.
User problem
Users want to identify their “best” or most-important blocks by how heavily they tag/reference them. Today, Query Builder can filter and sort, but cannot:
- count refs/tags per block
- group results by block
- sort blocks by aggregate values (e.g. tag count)
This makes it impossible to answer questions like:
- “Which blocks in my graph have the most tags?”
- “Show me my most-referenced blocks”
- “Rank blocks by number of page refs”
Concrete use case (from James D)
“I’d like a query that shows me the blocks in my graph with the most tags. The blocks I tag the most are the best ones. I need to get all those together somehow.”
Proposed capabilities
-
Aggregate functions:
countcount-distinct
-
Grouping:
- group by block
-
Sorting:
- order results by aggregate values (descending / ascending)
-
Optional filters:
- exclude specific tags/pages from counts
Example (conceptual syntax)
FIND node
WHERE node has references
GROUP BY node
SELECT count(references) AS tag_count
ORDER BY tag_count DESC
Why this matters
- Enables ranking, curation, and sense-making workflows
- Aligns Query Builder with core datalog capabilities
- Unlocks advanced “knowledge gardening” use cases without JS or custom queries
- High leverage for power users without increasing UI complexity (can be progressive / advanced mode)
Related
- No current workaround in Query Builder
- Requires raw datalog or external processing today
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels