-
Trilium Version0.62.5 What operating system are you using?Windows What is your setup?Local + server sync Operating System VersionWindows 10 DescriptionStart a new search, if I use the search string "#active", I get 2 notes in result. While if I use the following search script, I get no result: const candidateNotes = api.searchForNotes("#active"); Error logsNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Hi @markbj71! I'm Dosu and I’m helping the Trilium team. The scripting API's search function (api.searchForNotes) doesn't always handle tag shortcuts like "#active" the same way as the main search bar. In scripts, you may need to use the explicit syntax tag:active instead of #active. Try this in your script: const candidateNotes = api.searchForNotes("tag:active");
return candidateNotes;This difference comes from how the backend parses search queries for scripts versus the UI, and it's not clearly documented as a bug or intended behavior, but it's consistent with how the codebase handles search expressions. For more on search syntax, see the Trilium search documentation. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
Hi @markbj71! I'm Dosu and I’m helping the Trilium team.
The scripting API's search function (api.searchForNotes) doesn't always handle tag shortcuts like "#active" the same way as the main search bar. In scripts, you may need to use the explicit syntax tag:active instead of #active. Try this in your script:
This difference comes from how the backend parses search queries for scripts versus the UI, and it's not clearly documented as a bug or intended behavior, but it's consistent with how the codebase handles search expressions. For more on search syntax, see the Trilium search documentation.
To reply, just m…