Good day. New LogSeq user and loving it!
I created a simple search query that works just fine. However, now I want to pass in the search term from outside the query. Something like this:
Otherwise I guess you need to switch to advanced queries, which can receive query inputs via :inputs and have some more block-scoped dynamic variables like :query-page.
Hi, just stumbled upon this and it really is exactly what I am looking for. I’ve been trying to adapt the query to my use case, but I’ve been failing so far.
So basically I am trying to find all blocks that include the parent-block in their tags and also are a specific type.
So in this case I want to find all blocks with the type “bill” which include “technology” (the parent-block) in their tags.
To make things even smoother, instead of manually searching for “bill” as the :type I would like to search for the name of the page the query is on. So for example if the query is in a sub-block of “technology” on the page “bill” I want it to find all blocks that are tagged with “technology” and with the :type bill. I know there is an input for :query-page, but so far I haven’t really understood how to make it work. Any help would be much appreciated!
Thanks so much for your help so far! I followed your steps but so far still failing to get further. With the parent-block (e.g. “technology”) I can use ‘clojure.string/includes?’ to evaluate against :tags, since it’s multiple entries (e.g. “technology, camera, accessories”), but the :query-page (e.g. “Bill”) is exactly the :type I am looking for.
Here’s what I got so far when I put in “Bill” manually:
When I try to replace bill with the variable for :query-page I get no results. What am I doing wrong? Also, do I have to watch out for capitalization? I’m using it in German so most of my pages are capitalized.
Great, I could figure it out now! Seems to be the Gerrman language playing a role here with its capitalization
So basically :query-page returns the name of the page in all lowercase, so e.g. “Rechnung” turns into “rechnung”. Since the :type of the blocks I was looking for was “Rechnung” it didn’t return any results. Guess the easiest will be to just use all lowercase in :type from now on.
Or is there a way to transform :type to all lowercase in the query itself?