All Collections
Getting Around
Searching with the RemNote Query Language
Searching with the RemNote Query Language

The Query Language allows you to select Rems from your database that match specific criteria.

Soren Bjornstad avatar
Written by Soren Bjornstad
Updated over a week ago

The RemNote Query Language is used to describe what Rems 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, SomeRem represents a Rem 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, Cat in the screenshot above.)

  • Has Reference To (SomeRem): Matches Rems that reference SomeRem.

  • Is Tagged With (#SomeRem): Matches Rems tagged with SomeRem, as well as Rems tagged with any Rem that SomeRem is tagged with (tag inheritance).

  • Is Directly Tagged With (!#SomeRem): Matches Rems tagged with SomeRem (no tag inheritance).

  • Documents That Have (@SomeRem): Matches documents that contain SomeRem, either as a direct descendant or as a portal. (Documents that contain a reference to SomeRem are not included; if you want this behavior, try *SomeRem, explained below.)

  • In Document (^SomeRem): Matches Rems that you can see if you open the document SomeRem. This includes Rems in fixed portals, but not search portals, and does not include Rems that are children of collapsed Rems.

  • Descendant Of (^^SomeRem): Matches Rems that are direct descendants of SomeRem. This does not include Rems in portals, but does include Rems that are children of collapsed Rems.

  • Any Connection To (*SomeRem): Matches Rems that are connected to SomeRem through any kind of link other than parent/child (reference, tag, etc.).

Miscellaneous

  • Has Text ("text"): Matches Rems 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 Rems 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 Rem, rather than only at the start of the entire Rem. Then, if you have multiple “contains” filters in the same search query, RemNote goes through all of the Rems 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 Rem Type (remType:concept, remType:descriptor, remType:none): Matches Rems 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 Rems that match both terms X and Y.

  • X or Y: Matches Rems that match either term X or term Y, or both.

  • not X: Matches Rems that do not match term X.

  • X and (Y or Z): Matches Rems that match both X, and either Y or Z.

  • X and not Y or Z: Matches Rems that match X, but do not match Y; or Rems that match Z, irrespective of whether they match X or Y.

Did this answer your question?