org-roam / org-roam-server

A Web Application to Visualize the Org-Roam Database
MIT License
639 stars 51 forks source link

Nodes and headline links #63

Open fkgruber opened 4 years ago

fkgruber commented 4 years ago

Hi org-roam now supports headline links. This is particularly useful when we have whole books that we are reading with org-noter and want to point to specific sections. However, currently org-roam-server just points to the file. It seems that it would be more useful if it creates a new node to that headline. And maybe automatically add a link between that headline node and the file node

thanks FKG

goktug97 commented 4 years ago

As far as I know the headlines are stored as unique ids with their corresponding files. So I think It is not possible to add them as meaningful nodes without parsing the corresponding files.

    (headlines
     [(id :unique :primary-key)
      (file :not-null)])
goktug97 commented 4 years ago

Do you have any updates?

theotheo commented 4 years ago

I think it's very handy functionality. So is it quite hard to parse files?

goktug97 commented 4 years ago

It will cause drop in performance and the function runs every second. I think parsing every file that has headlines might cause performance issues. People already experiencing performance issues and because of that I added org-roam-server-network-poll variable.

Also having nodes which are named "Introduction" will clutter the graph. It can be grouped into one node but grouped nodes don't support some of the functions that are used.

theotheo commented 4 years ago

What if we use cache parsed files? Is it would help to keep performance at an acceptable level?

goktug97 commented 4 years ago

I don't know, it feels a little bit hacky. Also there are still cluttering problem and lack of functionality in clusters. If someone wants to try to implement this, can send a PR.

theotheo commented 4 years ago

BTW, I think to implement clusters or something! Is there any recommendations? Maybe we should open the separate issue to discuss clustering?

goktug97 commented 4 years ago

https://visjs.github.io/vis-network/docs/network/#methodClustering

It will probably require lots of changes in the current code.

Maybe headline title can be added directly to the org-roam. As far as I understood from the db entries there no title for headlines but there might be a way to get them without actually parsing the file if it is already present somewhere else. @jethrokuan Is there a way to get the headline string from the db without parsing the file?