mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
Updated Search (markdown)
parent
fd3971f8d0
commit
5fb1a4f57d
44
Search.md
44
Search.md
@ -1,3 +1,5 @@
|
|||||||
|
** Text below describes features as of Trilium 0.31 **
|
||||||
|
|
||||||
Trilium supports searching in notes. There are several ways to search notes:
|
Trilium supports searching in notes. There are several ways to search notes:
|
||||||
|
|
||||||
* full text search - search in text and [[code note|code notes]] content. Since this is implemented as a database search, this works only for not protected notes (doesn't matter if you're in protected session or not)
|
* full text search - search in text and [[code note|code notes]] content. Since this is implemented as a database search, this works only for not protected notes (doesn't matter if you're in protected session or not)
|
||||||
@ -5,7 +7,7 @@ Trilium supports searching in notes. There are several ways to search notes:
|
|||||||
* [[attribute|Attributes]] search - you can e.g. search for notes having certain label - see *Attribute query syntax* below.
|
* [[attribute|Attributes]] search - you can e.g. search for notes having certain label - see *Attribute query syntax* below.
|
||||||
|
|
||||||
* 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.
|
* 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 [[scripts|script]] through relation - upon expanding, the script will provide a list of results
|
* saved search can also reference [[script|scripts]] 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|keyboard shortcuts]].
|
You can activate search by clicking on magnifier icon on the left or pressing `CTRL-S` keyboard [[shortcut|keyboard shortcuts]].
|
||||||
|
|
||||||
@ -13,34 +15,32 @@ You can activate search by clicking on magnifier icon on the left or pressing `C
|
|||||||
|
|
||||||
Fulltext search is triggered whenever search string doesn't start with `@` (used in attribute search) or `=` (saved search with script). You can enter any text, but only alpha numeric words are being searched.
|
Fulltext search is triggered whenever search string doesn't start with `@` (used in attribute search) or `=` (saved search with script). You can enter any text, but only alpha numeric words are being searched.
|
||||||
|
|
||||||
Fulltext searches on undeleted, unprotected text and code notes which are not archived.
|
Fulltext searches on both title and content of undeleted, unprotected text and code notes which are not archived.
|
||||||
|
|
||||||
Fulltext is implemented using Sqlite's [FTS5](https://www.sqlite.org/fts5.html). This provides some advanced functionality, e.g. "NEAR(heavy metal)" will match notes only if a word "heavy" is close to "metal". But since this syntax is quite specific and easy to get it wrong, it is accessible only via `@text` virtual attribute. Such query would then look like this: `@text="NEAR(heavy metal)"`
|
Fulltext is implemented using Sqlite's [FTS5](https://www.sqlite.org/fts5.html). This provides some advanced functionality, e.g. "NEAR(heavy metal)" will match notes only if a word "heavy" is close to "metal". But since this syntax is quite specific and easy to get it wrong, it is accessible only via `@text` virtual attribute. Such query would then look like this: `@text="NEAR(heavy metal)"`
|
||||||
|
|
||||||
## Attribute query syntax
|
## Attribute query syntax
|
||||||
|
|
||||||
Following examples demonstrates syntax:
|
### Standard attributes
|
||||||
|
|
||||||
<li>Just enter any text for full text search</li>
|
Here you query by standard [[attributes]]:
|
||||||
<li><code>@abc</code> - returns notes with label abc</li>
|
|
||||||
<li><code>@year=2019</code> - matches notes with label <code>year</code> having value <code>2019</code></li>
|
|
||||||
<li><code>@rock @pop</code> - matches notes which have both <code>rock</code> and <code>pop</code> labels</li>
|
|
||||||
<li><code>@rock or @pop</code> - only one of the labels must be present</li>
|
|
||||||
<li><code>@year<=2000</code> - numerical comparison (also >, >=, <).</li>
|
|
||||||
<li><code>@dateCreated>=MONTH-1</code> - notes created in the last month</li>
|
|
||||||
<li><code>=handler</code> - will execute script defined in <code>handler</code> relation to get results</li>
|
|
||||||
|
|
||||||
* ```@abc``` - matches notes with label abc
|
* `@abc` - returns notes with label abc
|
||||||
* ```@!abc``` - matches notes without abc label (maybe not the best syntax)
|
* `@year=2019` - matches notes with label `year` having value `2019`
|
||||||
* ```@abc=true``` - matches notes with label abc having value true
|
* `@year!=2019` - marches notes with label `year`, but not having value 2019 or not having label `year` at all.
|
||||||
* ```@abc!=true```
|
* if you want to express condition that note must have `year` label, but not value 2019, then you can do that with `@year @year!=2019`
|
||||||
* ```@"weird label"="weird value"``` - works also with whitespace inside names values
|
* `@year<=2000` - return notes with label `year` having value 2000 or smaller. `>`, `<`, `>=` and `<=` are supported.
|
||||||
* ```@abc and @def``` - matches notes with both abc and def
|
* 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.
|
||||||
* ```@abc @def``` - AND relation is implicit when specifying multiple labels
|
* `@rock @pop` - matches notes which have both `rock` and `pop` labels
|
||||||
* ```@abc or @def``` - OR relation
|
* `@rock and @pop` is an alternative syntax for the same thing
|
||||||
* ```@abc<=5``` - numerical comparison (also >, >=, <).
|
* `@rock or @pop` - only one of the labels must be present
|
||||||
* ```some search string @abc @def``` - combination of fulltext and label search - both of them need to match (OR not supported)
|
* `and` has a precedence over `or` in case both operators are used in a search string
|
||||||
* ```@abc @def some search string``` - same combination
|
* `@frontMan=*John` - matches notes where `frontMan` label starts with "John". There's also `!=*` for "doesn't start with", `*=` for "ends with" and `!*=` for "does not end with"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* `@dateCreated>=MONTH-1</code> - notes created in the last month</li>
|
||||||
|
|
||||||
## Saved search
|
## Saved search
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user