Get AI summaries of any video or article — Sign up free
Logseq Office Hours #2: Building processes with queries thumbnail

Logseq Office Hours #2: Building processes with queries

Logseq·
6 min read

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

TL;DR

Queries in Logseq behave like saved searches that combine block structure, links, date filters, and properties to produce dynamic collections.

Briefing

Logseq queries are essentially saved searches that let users “slice and dice” their notes by combining block structure (indentation), links, date filters, and metadata properties—turning scattered journaling or task notes into repeatable, process-driven views. The session’s core message is that getting queries right depends less on memorizing syntax and more on thinking in Logseq’s fundamental units: blocks arranged into parent-child branches, connected by links, and enriched with properties.

The walkthrough starts with the building blocks. In Logseq, every bullet is a block (the smallest unit of knowledge). Indentation creates parent-child relationships, forming branches—collections of nested blocks that behave like a tree. Queries don’t just search a single bullet; they evaluate the branch context created by indentation. That’s why indentation matters: if related content sits at the wrong level (siblings instead of parent-child), the query results change because the branch membership changes.

Links are introduced as the second foundational concept. Square-bracket wiki links create bidirectional connections between pages and also between the page and the blocks that reference it. While search can be done via text patterns, links become especially powerful when used as query terms—allowing users to treat their graph structure like an index. This sets up the idea that queries can function like custom collections: a query can return all blocks that match certain link and text conditions, effectively acting as a dynamic page of results.

From there, the session moves into query logic using filters that resemble boolean search. Users can require multiple terms with AND, allow alternatives with OR, and exclude terms with NOT. A live example demonstrates how a query that looks for blocks containing both “journal” and “sad” returns the matching branch, and how unindenting changes which blocks belong to that branch—altering results. The key takeaway is that query outcomes reflect both the content you wrote and the structural relationships created by indentation.

The session then models a practical workflow for building queries step by step: start broad, verify results, then add constraints. A journal example begins with fetching all blocks between two dates using the between date filter (e.g., April 1st through today). Next, it narrows results to blocks linked to the journal page, then further filters to morning entries by adding additional arguments (and optionally excluding evening). The same incremental approach is repeated with properties—metadata stored as key-value pairs using the :: syntax. Properties enable more precise filtering, such as returning only entries where mood equals “sad” during morning.

Finally, queries are positioned as operational tools, not just search. The session shows how templates and properties can feed an “inbox” or pipeline: blocks created by templates appear in query-driven lists, and when a property like status changes (e.g., from to-do to done), the block disappears from one list and moves to another. Table view is highlighted as a major advantage of properties, since it can render property-based columns for easier review. Q&A addresses practical concerns like where to place tags (order doesn’t matter; the query returns the last matching block in a branch) and feature requests such as dropdowns for property values and better UI/visual query building. The session ends by pointing to a community hub for workflows and learning resources, emphasizing that documentation and query explanations still need refinement based on user feedback.

Cornell Notes

Logseq queries work best when users think in blocks, branches, links, and metadata. Indentation creates parent-child branch structure, and queries evaluate that branch context—so moving a block to a different indentation level can change results. Queries behave like saved searches using boolean-style logic (AND/OR/NOT) and can filter by dates (e.g., between April 1st and today), links (square-bracket wiki links), and properties (key-value pairs like mood:: sad). Properties unlock table view, making it easier to scan results. In practice, templates plus properties let queries act like inboxes and pipelines: when a status property changes, blocks shift between query-driven lists automatically.

Why does indentation (parent-child structure) matter for query results in Logseq?

Queries don’t only match a single bullet; they return results in the context of the branch created by indentation. In the live example, a query searching for blocks containing both “journal” and “sat” returns the matching branch. When the “sad” block is unindented to become a sibling, it no longer belongs to the same branch as the “journal” parent, so the query updates and the results change. The session frames this as a core reason users get confused: if related information sits at the wrong indentation level, the branch membership—and therefore what the query considers together—breaks.

How do links and properties differ as tools for finding notes?

Links (square-bracket wiki links) create bidirectional connections between pages and the blocks that reference them, and queries can use those links as search terms. Properties use the :: syntax to store key-value metadata (e.g., mood:: sad, time:: morning). Links are useful for graph navigation and lightweight association, while properties enable precise filtering and table view. The session emphasizes that properties are especially valuable because they can power structured views (tables) and support pipeline-style workflows via status changes.

What is the recommended method for building a complex query without getting lost?

The session recommends starting broad, confirming results, then adding constraints step by step—similar to “slice and dice” in data analysis. The journal example begins with a between date filter to fetch all blocks between April 1st and today. It then adds an AND condition to require blocks linked to the journal page, reducing results. Next it adds another constraint to isolate morning entries (and optionally exclude evening). This incremental approach helps users test each change and avoid building a large query all at once.

How does the between date filter work in practice?

The between filter is used to retrieve blocks within a date range. The session demonstrates using absolute dates via the date picker: between (dates April 1st to today). After running that filter alone, results include daily page content and other blocks. Adding additional filters (like requiring a journal link) narrows the output to just the journal entries the user wants.

How can queries function like an inbox or workflow pipeline?

Templates create blocks with metadata that queries use to populate lists. In the content creation pipeline example, a “to do” template creates tasks with properties such as status. A query-driven inbox shows blocks matching criteria like resource:: area/thinkset club and status:: to do, while excluding template blocks themselves using NOT. When the user changes status (e.g., to done), the block no longer meets the query conditions, so it disappears from the inbox and appears in the next pipeline stage.

What did Q&A reveal about tag placement and query matching?

Tag placement order doesn’t matter for matching: the query looks for the relevant tag/value within the branch. However, because queries return the last matching block in a branch, putting a tag in a child block affects which block appears in results. The session’s answer also notes that even if a tag matches at multiple levels, the query output reflects the last matching block in the branch context.

Review Questions

  1. When a query returns a branch rather than a single block, how does indentation change which blocks are considered part of that branch?
  2. Design a query for journal entries between two dates that also match a specific journal type (morning vs evening) using AND/NOT logic—what filters would you add in sequence?
  3. What advantages do properties provide over links for building dashboards, and how does table view relate to properties?

Key Points

  1. 1

    Queries in Logseq behave like saved searches that combine block structure, links, date filters, and properties to produce dynamic collections.

  2. 2

    Every bullet is a block; indentation creates parent-child relationships that form branches, and queries evaluate branch context rather than isolated bullets.

  3. 3

    Square-bracket wiki links create bidirectional relationships and can be used as query terms to find blocks connected to specific pages.

  4. 4

    Boolean-style logic (AND/OR/NOT) is the core mental model for combining filters and narrowing results.

  5. 5

    A practical query-building workflow is to start with one broad filter (like between dates), verify output, then add constraints step by step.

  6. 6

    Properties (key-value pairs via ::) enable precise filtering and unlock table view for scanning results efficiently.

  7. 7

    Templates plus properties make queries operational: changing a status property moves blocks between query-driven inboxes and pipeline stages.

Highlights

Indentation isn’t cosmetic in Logseq—moving a block to a different indentation level can change query results because branch membership changes.
A between date filter can quickly fetch a time window, but meaningful results usually require additional constraints like journal links or properties.
Properties power table view, turning query output into a structured, database-like view rather than a plain list.
Queries can act like inboxes and pipelines when templates create blocks and status properties determine which query lists they appear in.
Tag placement order doesn’t matter, but branch context determines which matching block ends up in the results.

Topics

Mentioned