The RemNote Query Language is used to describe what bullets you want to display in a Search Portal. You can use a wide variety of criteria and be much more specific than when using standard searches (e.g., in Ctrl+P search or reference search).
The Query Builder
There are two ways to write queries: by directly typing text, and by using the Query Builder, which provides a graphical interface for designing queries. You can open the Query Builder by clicking on the filter icon next to a search portal.
You can switch back and forth between using the Query Builder and directly editing the search query in the text box at any time. New users should start with the Query Builder.
Query Filters and Operators
Options in the Query Builder are shown in bold; the syntax used when manually writing a query is shown in monospaced font.
Connections
Here, SomeNote represents a Reference inserted into the query with [[ or @. (If you're using the Query Builder, you don't have to type [[; reference search will start automatically when you click in the right-hand drop-down)
Has Reference To (
SomeNote): Matches bullets that reference SomeNote.Is Tagged With (
#SomeNote): Matches bullets tagged with SomeNote, as well as bullets tagged with any bullet that SomeNote is tagged with (tag inheritance).Is Directly Tagged With (
!#SomeNote): Matches bullets tagged with SomeNote (no tag inheritance).Documents That Have (
@SomeNote): Matches documents that contain SomeNote, either as a direct descendant or as a portal. (Documents that contain a reference to SomeNote are not included; if you want this behavior, try*SomeNote, explained below.)In Document (
^SomeNote): Matches bullets that you can see if you open the document SomeNote. This includes bullets in fixed portals, but not search portals, and does not include bullets that are children of collapsed bullets.Descendant Of (
^^SomeNote): Matches bullets that are direct descendants of SomeNote. This does not include bullets in portals, but does include bullets that are children of collapsed bullets.Any Connection To (
*SomeNote): Matches bullets that are connected to SomeNote through any kind of link other than parent/child (reference, tag, etc.).
Miscellaneous
Has Text (
"text"): Matches bullets that contain the string of text within the quotation marks.Text “contains” searches work in a somewhat peculiar way for performance reasons. You can usually think of “contains” as “contains a word which begins with the search text”.
Nitty-gritty details – only read this if you're experiencing unexpected behavior in your contains searches after reading the above: RemNote first searches for all bullets which contain a word beginning with at least one of the “contains” strings you typed. In contrast to the “starts with” search, this matches at the beginning of any word in the bullet, rather than only at the start of the entire bullet. Then, if you have multiple “contains” filters in the same search query, RemNote goes through all of the bullets it found in the first pass again, and shows only those that contain all of the “contains” filters as a substring; this time it does not have to be anchored at the beginning of a word.
Has Bullet Type (
remType:concept,remType:descriptor,remType:none): Matches bullets that are Concepts, Descriptors, or neither.~: The tilde is a valid expression that never matches anything. When writing a query, you can use this as a placeholder for an expression to be inserted later.
Boolean operators
Search terms above can be combined into expressions using and, or, and not, and grouped using Query Groups (in the visual query builder) or parentheses (in manually written queries). Here, X, Y, and Z represent connections or miscellaneous search terms from the lists above.
In manually written queries, and and or have the same precedence and are evaluated from left to right. not has higher precedence than either.
X and Y: Matches bullets that match both terms X and Y.X or Y: Matches bullets that match either term X or term Y, or both.not X: Matches bullets that do not match term X.X and (Y or Z): Matches bullets that match both X, and either Y or Z.X and not Y or Z: Matches bullets that match X, but do not match Y; or bullets that match Z, irrespective of whether they match X or Y.

