Finding Notes


Below is an example of a simple two level hierarchy with notes on various command line interface commands. Use Cmd+L (we are going to use mac keybindings for this tutorial) to bring up the lookup and try some of the following queries.

- cli.tar
- cli.curl
- cli.dig

Example queries

Non ordered querying

Entering tokens separated by space will query without caring about the order of elements. For example this note h1.h2.h3.h4 can be matched equally with the following non-ordered queries:

  • h1 h4
  • h4 h1
  • h2 h3

Hierarchy ordered querying

The above Non ordered querying is great to discover everything that matches our tokens. However, when we know the order of the hierarchy that we are querying it would be great to filter out matches that do not follow our order. Hence the ordered query is possible with separating query string by dots. So to match note h1.h2.h3.h4 ordered query queries could look like:

  • h1.h4 (h1 token must come before h4)
  • h2.h4 (h2 token must come before h4)
  • h1.h2 (h1 token must come before h2) Where the elements in the matched files should match the order of the dot delimited tokens.

Dot at the end == Descendent query

The above Hierarchy ordered querying is great when you know the ancestor and descendent (Eg. parent/child) of the hierarchy that you want to query. However, what if you only know the ancestor/parent of the note that you want to look up? Well in that case placing a dot/'.' at the end of the query is what you want. It will look up the notes that have children/descendents coming from your query. Ordering the most exact top level matches first.

For example if you query for data. And you had the following notes:

// This one will get filtered out completely since it does not have any mention of `data.`
// This one will get filtered out since it has no children/descendents coming from `data.`

The order that you would get will be as follows:

// 'data.driven' is at the highest level of hierarchy, 
// cleanly matches our query `data.` 
// and only has child level note, hence it comes to the top

// Absolute index of 'data.' match is closer to beginning in "".
// However, from hierarchy perspective 'data.' is higher in "" 
// hence it comes before ""

// When there are "non clean match" of data we still keep it but lower it below
// all the "clean matches" regardless of hierarchy depth. Non clean match 
// is when our query has a prefix within the same level of hierarchy such as `with-data.`
// while querying for 'data.'

// Now lastly come the nodes with grandchildren/descendents. 
// (Notice that all previous elements only had a child after our query)
// First with clean match, then with non clean match.

Extended Search Syntax

We use FuseJS for our note lookup and support the extended search syntax.

TokenMatch typeDescription
jscriptfuzzy-matchItems that fuzzy match jscript
=schemeexact-matchItems that are scheme
pythoninclude-matchItems that include python
!rubyinverse-exact-matchItems that do NOT include ruby
^javaprefix-exact-matchItems that start with java
!^earlanginverse-prefix-exact-matchItems that do not start with earlang
js$suffix-exact-matchItems that end with js
!go$inverse-suffix-exact-matchItems that do NOT end with go

White space acts as an AND operator, while a single pipe (|) character acts as an OR operator. Hence multiple items can be used in a single query such as:

  • ^java awesome !verbose nice$ means query for items that start with java, do include awesome anywhere in the file name, do NOT include verbose, and end with nice.

    Note: . have special behavior in Dendron (Example Finding Notes) Hence when using complex extended syntax searches in general its advised to avoid dots . if possible.