Get AI summaries of any video or article — Sign up free
Logseq Simple Queries - All the basics to filter what you need thumbnail

Logseq Simple Queries - All the basics to filter what you need

Tools on Tech·
6 min read

Based on Tools on Tech's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.

TL;DR

Logseq simple queries require correct curly-brace structure; misplaced brackets can turn functions into literal searches and cause errors.

Briefing

Logseq simple queries hinge on one idea: build filters by combining functions (like task) with operators (like and/or/not) inside the required curly-brace query structure. Once that mental model clicks, tags, priorities, date ranges, and custom properties can be turned into fast, reliable views—without hand-editing complex logic every time.

At the foundation is the query syntax: typing “/query” opens the query builder, where the core layout is curly brackets with the query inside. The builder can insert the needed structure automatically, so memorization isn’t the goal. More important is how functions and values work together. In Logseq’s query language, a function takes a value—so filtering tasks looks like using the task function with a target status (e.g., “to do” or “done”). A common failure point is placing curly brackets incorrectly or forgetting them, which can cause the system to treat a filter like a literal search term instead of a function.

The practical workflow starts with references and tags. For example, tasks can be tagged with contexts using GTD-style “@” tags such as “@home.” A simple query can then pull tasks that are both referenced to “home” (via page references) and have the task status “to do.” The transcript emphasizes how the query builder’s live view helps reveal what’s happening: an outer reference to “home” pairs with a task function, and an and operator forces both conditions to be true. Changing a task’s status immediately changes whether it appears—tasks marked “done” drop out when the query requires “to do,” and can be brought back by adjusting the query to include additional statuses.

Priority filtering builds on the same mechanics. Tasks tagged with Priority A/B/C can be combined with earlier context and status filters so that only tasks matching all required tags appear. The builder’s logic is cumulative: adding Priority A narrows results further, and switching to Priority B expands or changes the set depending on the operator logic. For ordered task lists, the approach recommended is to create multiple queries (e.g., one for Priority A, another for Priority B) and stack them in the page in the order they should appear, rather than jumping straight into advanced sorting.

Date-based filtering uses the between operator, which is tied to journal dates. Tasks without journal dates won’t show up in date-range queries until they’re created on a dated journal page. For relative ranges, the transcript notes a limitation: the query builder can’t use “related dates” like “-7D” directly, so date math may need to be written in code (e.g., “minus seven days” to “today”).

Properties are the next major power feature. Block properties (like system = Xbox/PlayStation) let queries slice tasks by structured metadata, and results can be rendered as tables showing which property values matched. Page properties extend this for time-series tracking: a journal template can store hours worked as a page property, and a page-property query can list hours by date so timesheets can be filled quickly. Finally, operators—and, or, and not—control how conditions combine: and requires all matches, or accepts any, and not removes items (useful for excluding clutter or completed items). Debugging guidance is pragmatic: if nested logic breaks, break the query into smaller pieces and keep nesting shallow (roughly two layers) before resorting to advanced queries.

Cornell Notes

Simple queries in Logseq work by combining required curly-brace query structure with functions (like task) and operators (and/or/not). A typical filter uses page references (e.g., a “home” context) plus the task function to restrict results to tasks with a specific status such as “to do.” Tags and priority markers (Priority A/B/C) can be layered so only tasks matching all required conditions appear, and multiple queries can be stacked to create an ordered task list. The between operator filters by journal dates, while block and page properties enable structured slicing (e.g., system = Xbox) and time-series tracking (e.g., hours worked per day). Operators and nesting depth matter for correctness and debugging.

What are the two core building blocks of Logseq simple queries, and why do curly braces matter?

The core building blocks are (1) the required curly-brace query structure and (2) the way functions take values inside that structure. The curly brackets must be placed correctly; errors often happen when brackets are missing or placed around the wrong part, causing the system to treat a filter like a literal search instead of a function. The query builder can insert the curly-brace layout automatically, but the logic still depends on functions (for example, task) being wrapped and paired with the right value (like “to do”).

How does a “context” filter (like @home) combine with task status in a working query?

A context tag such as “@home” is used via page references, while task status is enforced via the task function. In the transcript’s example, the query uses a reference to “home” and then a task function that targets “to do.” An and operator ties them together so both conditions must be true: tasks tagged at home and marked as to-do appear; tasks tagged at home but marked done are filtered out. Changing the task’s status updates the query results immediately.

How do Priority A/B/C tags change what appears, and how can multiple priorities be displayed in order?

Priority tags act like additional required conditions when combined with and. Adding Priority A to the existing context/status filter narrows results to only tasks marked Priority A. If a task’s priority changes to Priority B, it drops out of the Priority A view and reappears under a Priority B query. For ordered lists, the transcript recommends creating separate queries for each priority (A on top, B below) and stacking them on the page rather than relying on advanced sorting.

What does the between operator filter on, and what’s the limitation with relative dates in the query builder?

The between operator filters based on journal dates. Tasks that aren’t created on dated journal pages won’t show up in date-range queries. For relative ranges, the transcript notes that related-date expressions like “-7D” can’t be entered through the query builder (it won’t accept the entry), so relative date logic may need to be written in code. The example uses a range like “minus seven days” to “today,” which then correctly returns tasks within that window.

How do block properties and page properties differ in what they enable?

Block properties attach structured metadata to individual blocks (e.g., system = Xbox or PlayStation). Queries can filter tasks by property values and even render results as tables showing which property values matched. Page properties attach metadata to pages, which enables time-series tracking in journals—for example, storing hours worked as a page property and then querying page properties to list hours by date for quick timesheet entry.

How do and/or/not operators change query results, and what debugging strategy helps when logic breaks?

and requires all conditions to match; or accepts any of the listed conditions; not excludes items that match a condition. The transcript gives a practical use for not: excluding a tag like @home or using a “no filter” tag (F) to remove items from long filter chains. For debugging, if complex combinations behave unexpectedly—especially with deeper nesting—the guidance is to break the query into smaller pieces and keep nesting shallow (around two layers) before moving to advanced queries.

Review Questions

  1. In a query that filters by both a page reference (like home) and task status (like to do), what operator ensures both conditions must be true?
  2. Why might a task fail to appear in a between date-range query even if it has a relevant tag?
  3. When would you use not in a Logseq query, and how does it differ from and/or?

Key Points

  1. 1

    Logseq simple queries require correct curly-brace structure; misplaced brackets can turn functions into literal searches and cause errors.

  2. 2

    Functions like task filter by values such as task status (“to do” vs “done”), and they must be paired correctly with the intended value.

  3. 3

    Page references (e.g., a “home” context) combine with task functions using and to ensure tasks match both the context and the required status.

  4. 4

    Priority tags (Priority A/B/C) can be layered into queries to narrow results, and multiple queries can be stacked to create an ordered task list.

  5. 5

    The between operator filters by journal dates, so tasks must be created on dated journal pages to appear in date-range results.

  6. 6

    Block properties enable structured filtering (and table views) by metadata like system = Xbox/PlayStation.

  7. 7

    Operators and nesting depth matter: and requires all matches, or accepts any, not excludes; when logic breaks, split into smaller pieces and keep nesting shallow.

Highlights

A working “context + task status” query pairs a page reference (home) with the task function (to do) using and, so only tasks matching both appear.
Priority filtering is cumulative with and: adding Priority A narrows results, and changing a task’s priority moves it between query views.
between is journal-date based—tasks without journal dates won’t show up until they’re created on a dated journal page.
Block properties let queries slice tasks by structured fields like system = Xbox, and results can be displayed in tables.
not is the practical tool for exclusions—use it to remove clutter or completed items from otherwise broad lists.

Topics

  • Query Syntax
  • Task Filtering
  • Tags and Priority
  • Date Ranges
  • Properties
  • Operators