Introduce :embedding-block query variable for embedded queries

With :current-page we can point to the page, where a query is embedded - say page R.
:query-page can be used to get the page, where this query is defined/declared - say page D.
(Both are described in https://docs.logseq.com/#/page/advanced%20queries)

Analogue to this pair, I would expect :current-block to point to the using block in page R, and something like :query-block to point to the block with query definition inside D. But this is not the case! :current-block will always point to the block in D, which is not intuitive.

Please make block and page variables consistent and provide a way to target both ends. And while we are at it, I’d suggest to replace the term current, as ambiguous in this context. What about embedding, or using? Term query is better, but why not use something even more clear like definition or origin?

To sum up with an example:
:embedding-block/embedding-page → using side for embedded queries
:origin-block/origin-page → definition side for embedded queries

While true, there is some nuance. The docs state “lower case name of current page the user is in.”.
This means that if you have a query open in the sidebar it will look at the page in the main window. So its use is more broad than just embedded queries.

That would be an improvement. We don’t currently have :query-block. :current-block and :parent-block are both using the defined query placement.

Those terms are no less ambiguous actually. Considering my earlier comment. I don’t think there’s a good general term without ambiguity.

I feel query captures the idea quite elegantly. Definition and origin are a bit vague in comparison I think.

Ps. This is not actually a bug, more a feature request / feedback / suggestion.

2 Likes

Thanks @Siferiax , I had misconceptions about the usage scope of :current-block.

I think this feature would be a good idea for reusable embedded queries. But if we keep current-block functionality, the opposite should get a different name than :query-block to make it better distinguishable from :query-page, which has the opposite function for pages.

Can a mod change this to a feature request and rename the title to “Introduce :embedding-block query variable for embedded queries” (just to give it a first name). Otherwise I’ll create a new post.

@bullseye done, feel free to tag me for this kind of requests, though there should be the @moderators tag too (but I have never used it).

1 Like

I second this suggestion. It would be helpful to have something like :query-block that behaves for blocks the same way that :query-page behaves for pages.