-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Search
Trilium supports searching in notes. There are several ways to search notes:
-
local search - searches within currently displayed note. Press
CTRL-Fto open the search dialog. In server version this is handled by the browser, in desktop (electron) version there's a separate dialog. -
note search - you can find notes by search for text in the title, note's content or note's [attributes]. You can also save search.
-
you can save search string (composed of either fulltext or attribute search) into so-called "saved search" note. If you expand this note, you will see the search results as child notes.
- saved search can also reference script through relation - upon expanding, the script will provide a list of results
You can activate search by clicking on magnifier icon on the left or pressing CTRL-S keyboard shortcut.
Fulltext search is triggered whenever search string doesn't start with # (used in attribute search).
Fulltext searches on both title and content of undeleted, unprotected text and code notes which are not archived.
Input string is tokenized by whitespace separators and each individual token (word) must be present in the title, content or note's attributes. If you don't want this automatic tokenization, you can surround your search with double quotes, e.g. "hello world" will search for exact match.
Here you query by standard attributes:
-
#abc- returns notes with label abc.~abcwill look for notes with relation abc. -
#!abc- returns notes which don't have label abc -
#year = 2019- matches notes with labelyearhaving value2019 -
#year != 2019- matches notes with labelyear, but not having value 2019 or not having labelyearat all.- if you want to express condition that note must have
yearlabel, but not value 2019, then you can do that with#year #year != 2019
- if you want to express condition that note must have
-
#year <= 2000- return notes with labelyearhaving value 2000 or smaller.>,<,>=and<=are supported.- In this case parameter can be parsed as a number so number-wise comparison is done. But it's also possible to compare strings lexicographically in the same way. This is useful for comparing dates as seen below.
-
#rock #pop- matches notes which have bothrockandpoplabels-
#rock and #popis an alternative syntax for the same thing
-
-
#rock or #pop- only one of the labels must be present-
andhas a precedence overorin case both operators are used in a search string
-
-
#frontMan =* John- matches notes wherefrontManlabel starts with "John". There's also*=for "ends with" and*=*for "contains".
It's also possible to query by so called "virtual attributes":
-
dateCreated- local date of note's creation date in YYYY-MM-DD HH:mm:ss.sss+OOPP where OOPP are hours and minutes of offset compared to UTC (e.g. "+0100" for Central European Time) -
dateModified- local date of last note's modification in YYYY-MM-DD HH:mm:ss.sss+OOPP -
utcDateCreated- UTC date of note's creation date in YYYY-MM-DD HH:mm:ss.sssZ -
utcDateModified- UTC date of last note's modification date in YYYY-MM-DD HH:mm:ss.sssZ noteId-
isProtected- 1 if the note is protected, 0 otherwise -
title- useful if you want to search title separately content-
type-text,code,image,file,book,searchorrelation-map -
mime- e.g.text/htmlfor text note -
text- fulltext attribute of both title and content together- For example
@text*=*Hello. So that you can combine searching for both text and attributes.
- For example
-
isArchived- filters only for archived notes,@!archivedthen filters only for non-archived notes. Note that this filter does not work in OR relation, it is always AND. -
in- for example@in=VuvLpfAPx2L9will filter only notes which have note with noteIdVuvLpfAPx2L9as one of the ancestors - i.e. note is in the subtree ofVuvLpfAPx2L9. With negating operator -@in!=VuvLpfAPx2L9will filter notes which don't have noteVuvLpfAPx2L9as their ancestor. Since Trilium 0.37
It's possible to order the results by one or more attribute, e.g. @orderBy=year,-genre will order notes by year label in ascending order and then by genre label in descending order (because of - sign).
You can also limit the number of results using e.g. @limit=1 will return only the first result. If there's no limit, then all notes are returned.
Attribute values are untyped strings which means that although you can save into it any kind of value like number or date, Trilium doesn't really know what kind of value it is and can't really treat it properly.
Fortunately if we stick to storing dates in YYYY-MM-DD format, we can still do quite a lot since such dates can be correctly compared as strings - e.g. @dateCreated>=2015-01-01 will return notes which were created since 2015 even though Trilium is doing just string comparison.
What if you want to find notes created in 2015? You can use "starts with" operator (=*) like this: @dateCreated=*2019 - this will match notes with label starting with string "2019" which all notes created in that year will satisfy.
Trilium supports few special values which will might help you with some search queries:
-
NOWmeans this instant to second precision, e.g.2019-04-01 10:12:54-
NOW-3600means 1 hour ago
-
-
TODAYmeans today with the day precision, e.g.2019-04-01-
TODAY-1means yesterday,TODAY+1means tomorrow
-
-
MONTHmeans this month, e.g.2019-04-
MONTH-1means last month - i.e.2019-03
-
-
YEARmeans current year, e.g.2019-
YEAR-1means last year - 2018
-
Using this you can create queries like:
-
@dateModified>=NOW-3600- show me notes changed in the last hour -
@dateCreated=*TODAY-1- show me notes created during whole yesterday
Opening Trilium like in the example below will open search pane and automatically trigger search for "abc":
http://localhost:8080/#search=abc
Note
Our documentation has moved to docs.triliumnotes.org/.
Note
Our documentation has moved to docs.triliumnotes.org/.
- Basic concepts
- Installation & setup
- Advanced usage
- Developer guides
- FAQ
- Troubleshooting