Skip to content
Discussion options

You must be logged in to vote

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 m…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by eliandoran
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant
Converted from issue

This discussion was converted from issue #4591 on October 14, 2025 19:34.