Skip to content

Query System

⚠️ Planned Feature: This feature is not yet implemented. The documentation below describes the intended design.

The query system provides a powerful language for finding notes based on complex criteria.

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
# Find notes with tag
notes where tags contains "project"
# Find notes in folder
notes where path starts_with "Projects/"
# Find notes modified recently
notes where modified > "2024-01-01"
# AND conditions
notes where tags contains "project" and status = "active"
# OR conditions
notes where tags contains "urgent" or priority = "high"
# Complex expressions
notes where (tags contains "project" and status = "active")
or priority = "high"

Query based on how notes connect:

# Notes that link to a specific note
notes where links_to "Projects/Alpha"
# Notes linked from a specific note
notes where linked_from "Index"
# Notes with many connections
notes where link_count > 10
# Sort by date
notes where tags contains "meeting"
order by modified desc
# Limit results
notes where folder = "Inbox"
limit 10
# Offset for pagination
notes where folder = "Archive"
offset 20 limit 10
# Count notes by tag
count notes group by tags
# Most linked notes
notes order by backlink_count desc limit 10
# Select specific fields
notes where status = "active"
select path, title, modified
# As list
notes where tags contains "todo" as list
# As table
notes where folder = "Projects" as table

Notes with no incoming or outgoing links:

notes where link_count = 0 and backlink_count = 0
notes where tags contains "meeting"
and modified > "7 days ago"
order by modified desc
notes where path starts_with "Projects/"
group by folder
select folder, count(*) as note_count
notes where tags contains "task"
and status != "completed"
and modified < "30 days ago"
/query notes where tags contains "research"
local results = cru.query("notes where status = 'active'")
for _, note in ipairs(results) do
print(note.path)
end
Terminal window
# Planned command (not yet implemented)
cru query "notes where tags contains 'important'"
  • Search & Discovery - All search methods
  • Tags - Tag syntax for filtering