Search nodes

Search nodes give you the power to find anything, anywhere in Tana. They are easy to make, and can exist anywhere you can add a node. The many search operators available put advanced tools in your hands to create very specific searches according to your needs.

Overview

Search nodes retrieve nodes from any workspace you have access to. Results show up as references to nodes. Editing these nodes will edit the original and every reference of it.

What a search node retrieves is based on the search query. The query specifies what you are looking for, and is made in the Query builder.

Search nodes have a magnifying glass as a bullet icon. So they're recognizable even when collapsed.

Basics

  • Search nodes run queries on your Tana data. Examples of queries include:
    • Look for recipes with specific ingredients: Find all nodes tagged #recipes with the field Ingredient==Tomatoes, Peppers
    • Look for filled-out Feedback fields under a draft: Find all nodes with field Feedback==Set that is descendant of the node Q4 workplan draft
    • Look for unfinished tasks with a date older than a specific date: Find nodes tagged #todo that is NOT DONE, and with a date that is older (less) than January 10
  • Queries are composed in the Query builder. The builder uses search operators that come in the form of Tana objects. All operators are listed here: Search operators. For an explainer on how to read queries, check out this article.
  • Search nodes only run when expanded. This means they are not running live in the background while collapsed.
  • You can add nodes via the list of results. These nodes end up on the daily page of the workspace the search node lives in. It will try to create a node that follows the conditions of the query. If it isn't able to, it will show as a "mismatch".
  • You can add a view to a search node. You can apply views to all nodes that have children, including search nodes.
  • Returned results are limited to a maximum of 2500 nodes. If you run searches that return more than 2500 nodes, it will not run and you'll be prompted to change your query to narrow your search even further.

Documentation

Creating a search node

Create a search node with a basic query

Find nodes in the command line guides you through a simple set of search terms:

  • Press Cmd/Ctrl+K > Find Nodes, then hit Enter and continue following the menu to specify what you're looking for.
  • Once you're done, choose the "show as list" option which will create the search node with the query pre-populated and as a list.

You can always modify the query after it's been created through the command line by opening the Query builder.

If you want to create an empty search node to have access to all options immediately, see the next section:

Create a search node with empty query

  • On any node, type ? , then click on the ✨Create search node button.
  • The Query builder will open immediately upon creation.

About queries

  • A search node filters results based on its query.
  • A query consists of one or more conditions that must be met in order for results to show up.
  • The queries can be seen by opening the Query builder.

Deleting a search node

  • Like with regular nodes, to delete a search node use right-click on the node and select "Delete node/reference", or use Cmd/Ctrl+Shift+Backspace
  • Treat a search node like you would deleting nodes and references.

Query builder

  1. The query builder (formerly "search expression") popup
  2. Area for composing the query
  3. Easy access to search operators, field values, system fields and more
  4. Linter that shows current query written out as plain code
  5. "Run once" refreshes results while the builder is still open, and "Done" closes builder and refresh results)

AND wrapper

The entire query is wrapped in an AND operator, so by default every search criteria on the the query will return results that match every condition. For example, the screenshot below is looking for all nodes tagged #todo, AND it has to be NOT DONE, AND with a date that is older (less) than January 10 . Nodes have to meet all criteria listed.

Search operators

Below is the full list of all operators that work in the query builder.

Nodes and text

Tana objects that can be used in the query builder:

OPERATORDESCRIPTIONLINTER
A referenceInserting a reference will return only descendants of the reference. Tip: Reference a Workspace to limit results to nodes that live in that Workspace only.DescendantOf:nodeName
A supertagInserting a supertag reference will return only instances of that supertag. Type # and a list of supertags will pop up.Tag:tagName
A field definitionInserting a field definition will return only nodes that have this field, and a value set for it.hasField:fieldName
A field with one or more valuesInserting one or more plain text or reference values in a field will return nodes with this field that contain any of these values.fieldName==Hello world
A plain text nodeInserting a plain text node that is not a reference will return nodes that match the text.StringMatch:"hello world"
A node with a dateInserting a date will return nodes whose name contains a dateDateWithin:date
A regular expression between /.../Inserting a regular expression between the two forward slashes will return nodes that match the regular expression.RegexpMatch:/yourRegEx/

Field operators

Add values to these fields to configure them.

OPERATORDESCRIPTIONLINTER
>ANDAll of the clauses in the field values should match. AND is implied at the top level of the query builder as well.AND
>ORAny of the clauses in the field values should match.OR
>NOTNegates a single clause (if you want to negate multiple, you need multiple NOT statements).NOT
>LTLT = Less than. The LT field value should be the field you want to query with a field value (a number/date). This finds nodes that have a value less than the value provided. Also works with dates.fieldName < fieldValue
>GTGT = Greater than. The GT field value should be the field you want to query with a field value (a number/date). This finds nodes that have a value greater than than the value provided. Also works with dates.fieldName > fieldValue
>LINKS TOThe LINKS TO operator finds all nodes that link to the reference in the field value. Only takes references or PARENT/GRANDPARENT. Similar to what is shown in a node's reference section.LinksTo:nodeName
>CHILD OFIf the field value is a reference, the CHILD OF operator finds nodes/references that are children of the reference. If the field value is a field definition, the operator finds nodes/references that are children of this field.ChildOf:nodeName
>OWNED BYThe OWNED BY operator finds nodes that are children of and owned by the reference in the field value.OwnedBy:nodeName

Keyword operators

Type these keywords into a first-level empty node in the query builder.

Node type

OPERATORDESCRIPTIONLINTER
IS TAGA keyword that finds any supertag definition.is:Tag
IS FIELDA keyword that finds any field definition.is:Field
IS CALENDAR NODEA keyword that finds year/week/day nodes under the calendar. Useful for excluding these from searches.is:CalendarNode
IS SEARCH NODEA keyword that finds any search node.is:SearchNode
IS COMMANDA keyword that finds any command node.is:Command
IS PUBLISHEDA keyword that finds any published node.is:PublishedNode

Node contents

OPERATORDESCRIPTIONLINTER
HAS FIELDA keyword that finds any node with a field.has:Field
HAS TAGA keyword that finds any node that has a supertag applied.has:Tag
HAS MEDIAA keyword that finds any node with a media attachment (audio, video, or image).has:Media
HAS AUDIOA keyword that finds any node with an audio attachment.has:Audio
HAS VIDEOA keyword that finds any node with a video attachment.has:Video
HAS IMAGEA keyword that finds any node with a image attachment.has:Image
FOR DATE [yyyy-mm-dd]A keyword that finds all nodes with an inline reference to the date specified.FOR DATE 2023-10-18

Scope

OPERATORDESCRIPTIONLINTER
PARENTS DESCENDANTSA keyword that finds nodes that are descendants of the parent of the search node, excluding references.DescendantOf:parentnodeName
GRANDPARENTS DESCENDANTSA keyword that finds nodes that are descendants of the grandparent of the search node, excluding references.DescendantOf:grandparentnodeName
PARENTS DESCENDANTS WITH REFSA keyword that finds nodes that are descendants of the parent of the search node, including references.InTreeUnder:parentnodeName
GRANDPARENTS DESCENDANTS WITH REFSA keyword that finds nodes that are descendants of the grandparent of the search node, including references.InTreeUnder:grandparentnodeName
IN LIBRARYA keyword that finds direct children of a Library node. The Library is a default node in each workspace.in:Library
ON DAY NODEA keyword that finds direct children of calendar day nodes.on:DayNode
SIBLING NAMED "[name]"A keyword that limits the search to descendants of the named sibling. Example: SIBLING NAMED "Meeting notes".DescendantOf:siblingnodeName

Checkbox

OPERATORDESCRIPTIONLINTER
TODOA keyword that finds all nodes with a checkbox, regardless if it is checked or not.is:Todo
DONEA keyword that finds any checked todos.is:Done
DONE LAST [num] DAYSA keyword that finds any todos that were manually checked within a certain number of days. Replace [num] with a number. Example: DONE LAST 7 DAYS.DONE LAST 3 DAYS
NOT DONEA keyword that finds any "not done" nodes, and unchecked todos. Combine with TODO to only find unchecked todos.NOT is:Done
OVERDUEAn old keyword that finds any unchecked todos 1. using the system-defined Due Date field, and 2. with a date value that is older than today's date. For a more robust overdue search query, see Examples section below.is:Overdue

Created/edited

OPERATORDESCRIPTIONLINTER
CREATED LAST [num] DAYSA keyword that finds any nodes created within a certain number of days. Replace [num] with a number. Example: CREATED LAST 7 DAYS.CREATED LAST 3 DAYS
EDITED BY [user email] LAST [num] DAYSA keyword that finds any nodes modified by a Tana user within a certain number of days. Replace [user email] with the email of the workspace member, and [num] with a number. Example: MODIFIED BY olaf@tana.inc LAST 7 DAYS.EDITED BY USER@TANA.COM LAST 3 DAYS
EDITED BY [user email] ANYTIMEA keyword that finds all nodes modified by a Tana user. Example: MODIFIED BY olaf@tana.inc ANYTIME. EDITED BY USER@TANA.COM ANYTIME
EDITED LAST [num] DAYSA keyword that finds all nodes edited within a certain number of days relative to today. Example: EDITED LAST 7 DAYS.EDITED LAST 3 DAYS

Field values

Use these as field values:

OPERATORDESCRIPTIONLINTER
PARENTUse in any field. Inserts the parent node relative to the search node. Useful for finding nodes with fields that use the parent/grandparent node as a field value, such as every #author node finding all #books they're the >Author of.fieldName==parentnodeName
GRANDPARENTUse in any field. Inserts the grandparent node relative to the search node. Useful for finding nodes with fields that use the parent/grandparent node as a field value, such as every #author node finding all #books they're the >Author of.fieldName==grandparentnodeName
FOR RELATIVE DATE [term]Use in date fields only. Inserts a date relative to today. Valid terms: yesterday, today, tomorrow, last/this/next week, last/this/next month. Example: FOR RELATIVE DATE next week.Date==RelativeDate:term=yyyy-mm-dd [timezone]
"Set"A system node you can use in any field. Finds nodes where this field exists and has a value.fieldName==Set
"Not Set"A system node you can use in any field. Finds nodes where this field does not exist, or has no value. Warning: will find many nodes.fieldName==Not set
"Defined" A system node you can use in any field. Finds nodes where a field is defined/used in a supertag template, but might still be empty.HasField:fieldName
"Not Defined"A system node you can use in any field. Finds nodes where a field is not defined/used in a supertag template, or does not exist. Warning: will find many nodes.NOT HasField:fieldName

PARENT/GRANDPARENT (P/GP) field values

Other than inserting the parent/grandparent node relative to the search node, these values have additional features that apply to fields and dates:

They can point to a field on the P/GP node using dot notation.

Example 1: PARENT.Description will point at the Description field on the parent.

Example 2: On a meeting node you could have a search to find other meetings for the related project of this meeting:

  • #meeting
  • >Related project==PARENT.Related project

They can be used for date comparisons under any calendar node

Using PARENT in a search node under a week or year node can now be used for date comparisons such as “find all tasks completed this week”. These date items will get the right granularity (day vs. week/month/year)

Also, PARENT that points at a date or a day/week/year node can do simple arithmetic. PARENT-7 on a day node would get the day 7 days earlier, PARENT+3 on a week node will get a date 3 weeks in the future.

Dot notation and date arithmetic can be combined in a field value

You can combine fields with date arithmetic, so PARENT.Due date+3 will be replaced with a date 3 days ahead of the date in the Due date field.

Search operator examples

Our Navigators have created a Tana Template full of search examples that allow you to interact with many of the operators below to see how they work. They cover the basics and will continuously be updated as we surface more useful examples from the community. Click below to save the resource in one of your Tana workspaces (opens a new tab):

Install: Tana Live Search Examples

Linter

About the linter

In the query builder, see marker 4 for the location of the linter.

The linter uses simple "code" to display the query logic without the fluff of the query builder interface.

By reading the output of the linter, you'll be able to tell if your query is configured as intended or not.

You'll know because all search operators show up in the linter in very specific ways. For instance, the linter will often "transform" from one state to the other as you're adding or typing out the operators. These provide clear clues on whether the operators are correctly setup or not.

See the column "Linter" in the list of search operators for what they should appear like in the linter if properly added.

Reading the linter structure

  • A condition is a question you're asking of Tana.
    • Example: Find all tasks that are not done, and due today.
  • Search operators are used to compose these questions, using one line for each condition. In the linter, they will look like this:
    • TODO
    • NOT DONE
    • Deadline < (RelativeDate:TODAY)
  • All conditions get wrapped in parentheses:
    • (TODO)
    • (NOT DONE)
    • (Deadline < (RelativeDate:TODAY))
  • Every top-level condition gets separated by the AND operator, because it wraps the entire query builder:
    • (TODO) AND (NOT DONE) AND (Deadline < (RelativeDate:TODAY))
  • To use the OR or NOT operators, they are added within the top-level AND operator, nested queries with OR and NOT operators will appear like this:
    • (TODO) AND (NOT DONE) AND (Deadline < (RelativeDate:TODAY)) AND ((Priority==P2) OR (Priority==P3)) AND (NOT Assigned to==Fei)
    • The above query is asking the following: Find nodes that are unchecked, with Deadline before Today, P2s or P3s, and are not assigned to Fei.

Examples

Searches in day supertag template

Put a search node in a day supertag template that has a field referencing the PARENT (will show up as "Date: Today, Wed, Oct 18" in linter). This will create searches that find nodes with dates that refer to that day like events, tasks, birthdays.

Searches in supertag template

Put a search node in a supertag template that has a field referencing the PARENT (will show up as INSTANCE in the linter). This will make searches adapt based on the instance. Example: a #person supertag with a search node that looks for all meetings where this #person has attended.

Find overdue tasks (using any field)

If your #tasks have checkboxes and a date field that signifies a due/do date, or deadline, you can build a query in your daily page (important) to find all tasks that are 1. unchecked, and 2. older than today. It will look like this:

  • #task
  • NOT DONE
  • >LT: >Date: PARENT


Related release notes

  • fixedCreating a node inside live searches was some times difficult (the darn things locked up after the first letter you typed. ) Now however... ⌨️ 🔡 ()
  • fixedWe fixed some bugs for live searches. The button sometimes said "Close query editor" even if query editor was not open. Now, however... case closed. ()
  • improvedLINKS_TO search expression clause should now work on calendar nodes by treating it as a date. Talk about being friend-zoned... ()
  • fixedThe keyboard cursor was 'lost' sometimes after clicking the 'search dot' to close the search explanation popover. We put plenty of wayfinding now to prevent this from happening in the future. ()
  • fixedHitting space in an options fields inside the query / live search builder, didn't show options. It does now. ()
  • fixedFilter by "No tag" now works again. ()

Related FAQs

  • Can I create search nodes using Tana Paste?

    Yes you can: We have a basic syntax for this which you can read about here.

    Example of a task search:

    %%tana%%
    - %%search%% Fei's tasks
    - OR::
    - [[#task]]
    - [[#CS todo]]
    - Assigned to::
    - [[Fei-Ling Tseng]]
    - NOT DONE

    When I paste the above, this is the result:

    Related docs:

  • How can I configure the view of a search node that exists in a supertag template? It's not showing me all options.

    Problem

    The query doesn't run in the template editor and so there are no search results available with which to set sort or group options.
    Until we have fixed this issue, this is a workaround that has been perfected by community member Darren Brierton (this is part of the new series called Darren's Frequently Answered Questions, or the D'FAQ if you may).

    Answer

    1. Create the search on the actual node, and adjust its options there.
    2. Then, open Filter and fill the text filter with gibberish (like "xyjzkwq") so the search node returns zero results
    3. Then, cut and paste (Cmd/Ctrl+X / Cmd/Ctrl+V) the search node into the supertag template
    4. Expand the node, and remove the gibberish text

    Are the gibberish text instructions necessary?

    The reason why the filter instructions are needed is because it prevents stale results from being copied over to the supertag template.

    Thank you Darren for drafting these thorough instructions until we sort things out!

    Related docs:

  • How can I find all nodes that have a specific word?

    There are multiple ways to search for a specific word - say you're looking for all nodes with the word bottle in it.

    • Option 1: Use the global search (Cmd/Ctrl+S) and enter bottle - then Option+Enter - and the search will be made into a search node in your workspace, and shown in a panel
    • Option 2: Cmd/Ctrl+K > Find nodes with text="bottle" as list
    • Option 3: In a search node, enter >LINKS TO::@bottle to find only linked items to the node
    • Option 4: In a search node, if you're searching for a node that has this word within its field's value, enter the field in the search and the value /bottle/ . Be sure to put the slashes as shown, this will run the value as a regex match
    Source of FAQ: Tana Community Resource Hub

    Related docs:

  • How can I find all tags that extend a tag?

    One way is to create this search node:

    • >system field Tags : #tag (use supertag that was extended)
    • IS TAG

    Example:

    Related docs:

  • How can I find nodes where the node descriptions are empty/not set?

    You can use regex to find this:

    • Add a reference to the area you want to search within
    • >NOT >Node description:: /.+/

    Related docs:

  • How can I retrieve tasks dated for today?

    On the daily page (or any calendar node)

    • Create a search that uses PARENT in the field value of the Date field of the task.
    • With PARENT/GRANDPARENT in a date field:
      • you can append with -3 or +3 (use any number) to hit a specific date before/after the PARENT date, respectively. Example:
        • PARENT+3 = Any match on date 3 days from today
      • You can use GT/LT search operators (greater than or less than) together with PARENT to match a range of dates before/after today. Example:
        • >GT:PARENT-3
        • >LT:PARENT
        • = Any match between today and three days ago.

    If not on a day node

    • Use FOR RELATIVE DATE [term] as keyword field value for the Date field of the task, and insert today as the term, without the brackets.

    Related docs:

  • How can I search for content that is nested within one or more nodes?

    There are several ways to find content that is nested within one or more nodes:

    Search within

    Our global search (Cmd/Ctrl+S) and command "Search within" allows you to make that node and its contents the sole scope for your search.

    Search within (query)

    When defining a query in a search node, you can scope the search by adding a reference to the node you'd like to search within.

    Variations of PARENTS DESCENDANTS

    When creating a search node in a supertag template, you can make it a scoped search which looks at all descendants within each supertag instance by using the search operator PARENTS DESCENDANTS and its variations. For more on scoped search operators, see Search nodes.

    Field initialization

    Nodes can "clone" attributes from parent/ancestor nodes through field initialization settings. This can help you resurface things based on related attributes.

    For instance, if your meeting is about a certain client, your #meeting tag may have a field called Client where your "Acme Inc." client is defined. Then, when you are taking meeting notes and define a #task there, your task can have the same Client field inherit the field value "Acme Inc.", which connects it to the same client as the meeting. Then you can separately search for all tasks that are related to that particular client.

    For more on field initialization, check out Fields

    Related docs:

  • I need help with date search! How do I do X?

    It depends on what you want to find, the context of the search (which part of the graph it is made in), and the time scale/granularity you are looking for.

    Below are possible queries you can use to find date-related things in Tana. A quick legend:
    > : Typing this key starts a field anywhere in Tana, so we prefix fields with this sign when writing out queries in text

    LT/GT : Less than/Greater than field operators

    text : Text in this style is meant to be written out

    I want to find all overdue items from a deadline date field...

    • based on what the time is right now (most efficient graph-wise):
      • >LT : >your deadline field : FOR RELATIVE DATE today
      • Example: You are making a task dashboard in the tree that is always showing you information based on the current time
    • based on the date in a date field of parent node:
      • >LT : >your deadline field : PARENT.date field
      • Example: You can see overdue tasks based on the date of the meeting note
    • based on the date of an ancestor calendar node:
      • >LT : >your deadline field : PARENT/GRANDPARENT
      • Example: You have a search node as part of your #day supertag template

    I want to find deadline dates that fall within a range (let's say, a week)...

    • based on what the time is right now, and this/last/next week/month/year:
      • >your deadline field : FOR RELATIVE DATE this/last/next week
    • relative to a date field of the parent node:
      • >LT : >your deadline field : PARENT.date field
      • >GT : >your deadline field : PARENT.date field-7
    • relative to the date of a calendar node:
      • >LT : >your deadline field : PARENT
      • >GT : >your deadline field : PARENT-7

    I want to find nodes based on their location in the journal nodes...

    • To pick up the date based on the calendar node they are nested under, use system field Date from calendar node
    • For field value, use any variation from the above examples depending on need and context

    I want to find nodes relative to the search node's location in a journal node...

    • Relative to parent
      • PARENTS DESCENDANTS
      • Example: A search node on a day page limits search to only nodes that live on the parent Day page
    • Relative to grandparent
      • GRANDPARENTS DESCENDANTS
      • Example: A search node on the day page limits search to only nodes that live on the grandparent Week page
    • For both operators, add WITH REFS to include references in the search

    I want to find nodes based on when they were created/edited/done relative to now (replace X with a number)

    • CREATED LAST X DAYS
    • EDITED LAST X DAYS
    • DONE LAST X DAYS

    I want to find nodes based on when they were created/edited/done relative to a date field of the parent node

    • Use system fields Created time, Last edited time, and Done time
    • As field value, write out PARENT.date field

    To read about these search operators and more, check out Search Operators

    Related docs:

  • Should I use the DUE DATE field?

    TL;DR: No, create your own date fields.

    Background: Early on in Tana's history the team wanted a way to find overdue tasks but there was no current way of searching for nodes with dates relative to a certain date. So, the system field "Due Date" along with the search operator OVERDUE was created specifically this reason.

    But since the introduction of LT / GT (less than/greater than) operators, there is no reason to use the system Due Date field, along with the OVERDUE search operator.

    A user defined field for Date or Due Date offers more flexibility:

    • You can use initialize feature if desired
    • Consistent color with other fields
    • You can hide the field

    Example of a query to find nodes with a date that is past a certain time:

    Source of FAQ: Tana Community Resource Hub

    Related docs:

  • What is the difference between the Owner and a Parent of a node?

    The Owner is the node's home (where it was created). A node has only one owner, but can have many parents.

    PARENT / GRANDPARENT search operators are used to refer to one and two levels up in the outline, respectively

    Source of FAQ: Tana Community Resource Hub

    Related docs:

  • What is the difference between the field operator CHILD OF and the keyword operator PARENTS DESCENDANTS

    The search operators CHILD OF and PARENTS DESCENDANTS are similar, but have some key differences:

    • With CHILD OF, the target node is the node that you reference in it, and the results will only be direct children of the referenced node, including references
    • With PARENTS DESCENDANTS, the target node is the parent relative to the search node, and the results will match any descendant (children, grandchildren, great grandchildren etc.) of the target node, ignoring reference nodes
    • With PARENTS DESCENDANTS WITH REFS, the same as PARENTS DESCENDANTS except it includes reference nodes.
    Source of FAQ: Tana Community Resource Hub, rewritten for clarity

    Related docs: