Correct way to filter file by tags

I want to create a backend for searching roam notes in snails (something like helm). And one of the purposes is filter files by tags. My current implementation is using like, i.e:

(let ((query [:select [file tags]
                       :from tags
                       :where (like tags '("%link%"))
                       :and (like tags '("%vehicle%"))
                       ])
      )
  (org-roam-db-query query) 
  )

I’m not quite familiar with sqlite and emacssql, is there a better way to do that?
Thanks!

1 Like