Help with query and templates

I spent some time researching Silverbullet and I think it feels like just the thing I am looking for. At the moment I have a note taking app that I pay an monthly sub for and in syncs between my various devices. Looks like SB could be my new best friend for it's dynamic content, and I can then cancel and redirect my sub to this project :slight_smile:

Anyway, I digress.

One feature which excites me is queries. I've imported all my meeting note from another service and they are all tagged with #meeting plus the general topic matter. Let's say #work and #personal for simplicity.

Next i use the /task (which is phenomenal) when tasks come up in the meetings.

I'd like to have a query that shows me tasks for specific tags only. I've been trying something like:

${template.each(query[[from index.tag "task" where _.tags = "personal" ]],templates.taskItem)}

I'm not sure if I am misunderstanding the syntax, or I just don't know the correct fields (e.g. tags).

Is there some detailed documentation that I can read through. I've watched the videos but they're quite fast paced and not too much detail on structure. I get that they are only intro videos.

Also, I am not sure on how templates.taskItem works. Is it a template on how to present the rows? Can I modify this? Create my own? How would that look?

I can get my query to work without the where filter, but I would like to fix the presentation to be simpler. At the moment it will show each task with the page name and @ location and the task. I'd really like to just show the task, which I can click to take me to the page it is on.

Thanks for an pointers to docs, or help. I'm feeling a little lost right now with queries but I will get there I am sure.

${template.each(query[[from index.tag "task" where table.includes(tags,"personal") ]],templates.taskItem)}

Thanks, but that only gives me tasks where the # tag is on the same line as the task description. My tags are at the top of the page. Ideally I want all tasks on a page that is tagged (in this example) #personal

Ops... now we are using itags

${template.each(query[[from index.tag "task" where table.includes(itags,"personal") ]],templates.taskItem)}

Regarding:

${template.each(query[[from index.tag "task" where _.tags = "personal"  ]],templates.taskItem)}

While LIQ (language integrated query) looks like SQL, it is not. Expressions like after a where clause are Lua expressions, and in Lua = means assignment. You should see a parse error in the editor for this reason, should use == instead.

Also I'd slightly tweak @marcoswur 's expression here to name your iterator variable as follows, it's more clear and less ambiguous (I'm also updating examples on silverbullet.md in this style) and slightly more performant (and potentially can be optimized more later whereas the current notation cannot):

${template.each(query[[
  from t = index.tag "task" where table.includes(t.itags,"personal") 
]],templates.taskItem)}