TreeQuery: A clever search tool

I don’t know much about this but I’m sure it’s of interest here. I’m posting a link to the Twitter discussion; you’ll have to click through to see the whole context, but the question below (to which the answer is yes) is what makes me excited about TreeQuery.

Another query I find myself sometimes wanting to run is to restrict based on some current node and then search in related nodes, both children and parent nodes up to some degree. It’s because often I can find a node that I think is distantly related to some search I want to run but the usual search tools return too much noise.

In the case you described the X would be any text in the current node and the Y would be some search term that is queried in closely related notes.

Of course this doesn’t work well if you hope to find a node that is an orphan or not connected, even distantly, to the starting point.

Not sure if the TreeQuery would apply here.

There’s a cheesier but easy solution if you can anticipate needing to search a bunch of files: Put them all in the same folder. This offers none of the advantages that a graph offers, but if you expect, for instance, to want to grep all your Emacs notes for the same term, you can put them in the same subfolder in your org-roam tree. Org-roam doesn’t care; it’ll rrecurse into those folders transparently.