[Solved] Advanced querie to get blocks referencing a page with a specific tag

Hi, lets say I have some pages in my graph with the tag “book”, and I want to get all the blocks in these formats:

TODO [[Alice in Wonderland]]

Alice In Wonderland is a page with:

tags:: book, some other thing

Or also return block if its like:

TODO Alice in Wonderland #book

So, as a part of my querie I have the following rule, wich can return

[(refers-to ?b ?tags)
[?b :block/refs ?ref]
[?ref :block/name ?ref_names]
[(contains? ?tags ?ref_names)]
(page-tags ?ref ?tags)

page-tags is the rule from https://github.com/logseq/logseq/blob/master/deps/db/src/logseq/db/rules.cljc, I don’t know why but I had to copy it to my :rules statement to avoid error.
This does return this format:

TODO Alice in Wonderland #book

But no:

TODO [[Alice in Wonderland]]

Any help would be welcome!

I figured out that I was bad understanding how page-tags work, instead I used:

(page-property ?ref :tags ?tags)

If you provide actual queries, more people would bother reproducing your issue and try to help.