Query syntax: search for undone tasks under a heading

Use case or problem

I would like to use a query to find all undone tasks that exist under a specific heading. That is, I’d like to do something like:

task-todo:(heading:"next actions")

I know this is possible with some plugins, but I’d like to have it worked out in query language because I then want to use the text-expand plugin (which uses the query language) to put the text of the hits directly in the file (for sharing to other apps).

Proposed solution

Make it possible to nest other search operators within the “task-todo” operator. Additionally, create a “heading” search operator that looks for hits under a certain heading.