When I make subheadings into their own nodes (by giving them IDs), nearly all of the time I would prefer they have a different title for search (-ing from everywhere else) than the heading’s name in the document. So, for example, if I make the “History” subheading in the file “Pink” into its own node, I’d like to label it “History” within the document but I’d prefer to search for it with “History of Pink”, and only search for it as “History of Pink”. If I use aliases, the generic title “History” would get cluttered pointing to many different nodes.
I understand why titles have to be unique, but I don’t like making these wordy subheading inside larger documents that makes them harder to read—it’s not how subheading should be. Can’t we have a feature where we can set a “canonical title” or “alias” of sorts for subheadings that are nodes, different from the actual text of the subheading, which will be the only thing they can be searched by?
Why not create IDs that have this structure: eg. the ID of this node would be pink-history then you can search for History Pink and find the corresponding node.
it is also doable to create a hierarchical search using sqlite and some custom code: match any node that has any of the substrings in the current node (at least one) and its parents (any of the remaining ones)
I poked a bit at the database. This info is already in the table nodes: the attribute olp is a list of the titles of the parents. This means it is relatively straightforward to write a function that uses this data to search. It might be as simple as writing a template to the org-roam-visit-node function that includes olp and title.
Otherwise, one of the functions that @akashp wrote some time ago to improve the access to the DB can be modified to return this data as a string, instead of the title
…
after poking at the code… all you need to do is modify your template to include “olp”. It will show the parents of the node as a list separated by " > ". Very nice.
Thank you so much, this is pretty much what I wanted: the hierarachy to be visible. I’d have preferred to be able to format it differently on a node-to-node basis,[1] but the “>” is simple and universal so it’s a small peeve.
E.g. maybe in a node about an artist with subheading being their works—the whole thing could be formatted as “Work”, by Artist in Org-roam’s search. ↩︎
In the default search interfaces, org-roam-capture and org-roam-node-find, only a single title out of identical ones (having unique IDs) is displayed—so, in practise, it might as well be that you need unique titles.