Skip to content

Queries

Queries let you filter Objects by their property values using structured filter rules. Unlike search, which matches free-text across all content, queries target specific properties with typed operators.

Queries use structured FilterRule conditions to match Objects. Each rule specifies a property, an operator, and a value. When multiple rules are provided, they are combined with AND logic — only Objects matching all conditions are returned.

The type property is a special filter that matches the Object’s type name. All other properties match against frontmatter property values.

Use the CLI to list all objects or search:

Terminal window
# List all objects
tmd object list
tmd object list --json
# Full-text search
tmd search "concurrency"

Archived objects are excluded from queries and list results by default. This keeps your default views free of soft-deleted content without permanently removing it from the vault. To include archived objects, use the --include-archived flag:

Terminal window
tmd object list --include-archived

Views support type-aware filter operators. Each property type has a defined set of valid operators:

Property typeOperators
string, urlis, is_not, contains, does_not_contain, starts_with, ends_with, is_empty, is_not_empty
numbereq, neq, gt, gte, lt, lte, is_empty, is_not_empty
date, datetimeeq, before, after, on_or_before, on_or_after, is_empty, is_not_empty
selectis, is_not, is_empty, is_not_empty
multi_select, relationcontains, does_not_contain, is_empty, is_not_empty
checkboxis, is_not

Filter rules are defined in view configurations:

filter:
- property: status
operator: is
value: reading
- property: rating
operator: gt
value: "3"

Multiple filters are combined with AND logic.

If the SQLite index is unavailable (missing or corrupt), queries automatically fall back to filesystem scanning with in-memory filter matching. The fallback path supports all the same operators listed above, ensuring consistent results. Performance is degraded (O(n) file reads instead of indexed queries), but operations complete successfully. A warning is logged when fallback is triggered.

Queries support sorting by property values. When used via the TUI view mode, sort rules are defined in the view configuration:

sort:
- property: rating
direction: desc

Sort direction is either asc (ascending) or desc (descending). Multiple sort rules are applied in order (first rule is the primary sort).

  • Search — full-text search across all content
  • Views — view configuration format
  • Data Model — querying details