Query System
⚠️ Planned Feature: This feature is not yet implemented. The documentation below describes the intended design.
Query System
Section titled “Query System”The query system provides a powerful language for finding notes based on complex criteria.
Overview
Section titled “Overview”While simple search is available through chat commands like /search, the query system will let you:
- Combine multiple conditions
- Filter by relationships
- Aggregate results
- Transform output
Basic Queries
Section titled “Basic Queries”# Find notes with tagnotes where tags contains "project"
# Find notes in foldernotes where path starts_with "Projects/"
# Find notes modified recentlynotes where modified > "2024-01-01"Combining Conditions
Section titled “Combining Conditions”# AND conditionsnotes where tags contains "project" and status = "active"
# OR conditionsnotes where tags contains "urgent" or priority = "high"
# Complex expressionsnotes where (tags contains "project" and status = "active") or priority = "high"Relationship Queries
Section titled “Relationship Queries”Query based on how notes connect:
# Notes that link to a specific notenotes where links_to "Projects/Alpha"
# Notes linked from a specific notenotes where linked_from "Index"
# Notes with many connectionsnotes where link_count > 10Sorting and Limiting
Section titled “Sorting and Limiting”# Sort by datenotes where tags contains "meeting" order by modified desc
# Limit resultsnotes where folder = "Inbox" limit 10
# Offset for paginationnotes where folder = "Archive" offset 20 limit 10Aggregations
Section titled “Aggregations”# Count notes by tagcount notes group by tags
# Most linked notesnotes order by backlink_count desc limit 10Output Formatting
Section titled “Output Formatting”# Select specific fieldsnotes where status = "active" select path, title, modified
# As listnotes where tags contains "todo" as list
# As tablenotes where folder = "Projects" as tableExamples
Section titled “Examples”Find Orphan Notes
Section titled “Find Orphan Notes”Notes with no incoming or outgoing links:
notes where link_count = 0 and backlink_count = 0Recent Meeting Notes
Section titled “Recent Meeting Notes”notes where tags contains "meeting" and modified > "7 days ago" order by modified descProject Overview
Section titled “Project Overview”notes where path starts_with "Projects/" group by folder select folder, count(*) as note_countStale Tasks
Section titled “Stale Tasks”notes where tags contains "task" and status != "completed" and modified < "30 days ago"Integration
Section titled “Integration”In Chat
Section titled “In Chat”/query notes where tags contains "research"In Lua Plugins
Section titled “In Lua Plugins”local results = cru.query("notes where status = 'active'")for _, note in ipairs(results) do print(note.path)endFrom CLI
Section titled “From CLI”# Planned command (not yet implemented)cru query "notes where tags contains 'important'"See Also
Section titled “See Also”- Search & Discovery - All search methods
- Tags - Tag syntax for filtering