Repository navigation
Org SuperTag Query User Guide
yibie edited this page Jul 28, 2025
·
1 revision
- Tail: Empty list
^:nil - Startup: Show everything
showeverything
Org SuperTag Query provides two different query methods:
- File-internal query expression – Write the query directly in the org file; after execution, results are inserted into the file.
- Interactive query retrieval – Use an interactive interface to search, with results displayed in a dedicated buffer.
This method allows you to embed query expressions directly in the org file. After execution, results are inserted below the query block.
#+BEGIN_SRC org-supertag-query
query-expression
#+END_SRC
#+BEGIN_SRC org-supertag-query
(tag "project")
#+END_SRC
#+BEGIN_SRC org-supertag-query
(and (tag "work") (field "status" "done"))
#+END_SRC
#+BEGIN_SRC org-supertag-query
(term "idea")
#+END_SRC
#+BEGIN_SRC org-supertag-query
(not (tag "archive"))
#+END_SRC
- Insert a query block in the org file.
- Place the cursor inside the query block.
- Press
"C-c C-c"to execute the query. - Results will be inserted below the query block.
-
"C-c C-c": Execute the current query block. -
"M-x org-supertag-insert-query-block": Insert a new query block interactively.
This method uses an interactive interface to search, with results displayed in a dedicated query buffer.
- Call
"M-x org-supertag-query-interactive"or"M-x org-supertag-query". - Enter keywords (multiple keywords separated by spaces).
- View results in the dedicated query buffer.
- Perform selection, navigation, or export operations.
-
"project": Search for nodes containing "project". -
"idea work": Search for nodes containing both "idea" and "work". -
"urgent": Search for nodes containing "urgent".
- Call
"M-x org-supertag-query-interactive-sexp". - Enter an S-expression query.
- View results in the dedicated query buffer.
- Perform selection, navigation, or export operations.
-
"(tag "project")": Search for nodes with the "project" tag. -
"(and (tag "work") (field "status" "done"))": Search for nodes satisfying both conditions. -
"(not (tag "archive"))": Search for nodes without the "archive" tag.
-
"C-c C-q": Start interactive keyword search. -
"C-c C-s": Start interactive S-expression search.
In the query results buffer, you can:
-
"n/p": Navigate to next/previous result. -
"SPC": Toggle selection. -
"RET": Visit the selected node. -
"i": Insert a link to the selected node in its original location. -
"e f": Export to a specified file. -
"e n": Export to a new file. -
"q": Exit the query buffer.
-
"(tag "tag-name")": Search by tag. -
"(property "prop-name" "prop-Value")": Search by property. -
"(term "keyword")": Full-text search in headings and content.
-
"(and expr1 expr2 ...)": AND operation. -
"(or expr1 expr2 ...)": OR operation. -
"(not expr)": NOT operation.
You can now include time conditions to retrieve nodes created before, after, or within a specific timeframe.
-
"(before "date")": Find nodes created before this date. -
"(after "date")": Find nodes created after this date. -
"(between "start-date" "end-date")": Find nodes created between two dates.
Date arguments can be in one of three formats:
-
Absolute date: A string in
""YYYY-MM-DD"format (e.g.,"2023-10-26"). -
Relative date: A string with "+" or "-", a number, and a unit (e.g.,
"-7d"for 7 days ago). -
Current time: Use the string
"now".
- All string arguments in the query must be enclosed in double quotes (
").
#+BEGIN_SRC org-supertag-query :results raw
(and (tag "work") (tag "project"))
#+END_SRC
#+BEGIN_SRC org-supertag-query :results raw
(and (tag "task") (field "status" "done"))
#+END_SRC
#+BEGIN_SRC org-supertag-query :results raw
(between "-7d" "now")
#+END_SRC
#+BEGIN_SRC org-supertag-query :results raw
(and
(tag "project")
(term "Emacs")
(after "2023-12-31"))
#+END_SRC
- Ensure the database is initialized and synced (
"M-x org-supertag-sync"). -
File-internal query expressions use S-expression syntax; use
"M-x org-supertag-insert-query-block"to create properly formatted blocks. - Interactive query retrieval uses simple keyword searches.
- All string arguments in S-expressions (tags, property values, dates) must be enclosed in double quotes (
").