hasu / notdeft

NotDeft note manager for Emacs
https://tero.hasu.is/notdeft/
168 stars 14 forks source link

Provide a way to specify notdeft database location #18

Open harizvi opened 3 years ago

harizvi commented 3 years ago

The xapian database currently goes in .notdeft-db directory inside the org / roam directory. The db includes a few large files, and as the number of my notes is growing the size is growing, for example my .notdeft-db is now 44MB. From what I see each file is touched every time a note is touched.

I use syncthing to sync this directory across multiple machines, and therefore each time I touch a note all these files need to be replicated across. Also, there is a potential for corruption if for some reason files are touched on multiple machines.

For now I can work around this issue with symlinks, but it will be good to have a built-in solution. Thanks.

hasu commented 3 years ago

Two-way synchronizing ".notdeft-db" contents does sound like a recipe for a mess, you're right, and perhaps there indeed are some use cases where it would be quite essential to be able to keep the search indexes outside their note directories.

In your case, however, I wonder whether Syncthing doesn't provide some way to simply exclude certain directories from being synchronized?

harizvi commented 3 years ago

Yes, you can do things with syncthing (for a one-way push), or what I'm doing now (using symlinks to put the cache locally). Either case, it's external setup, and I've to periodically re-index for docs touched at other nodes. I think the setup will be easier if you can specify the database directories.

hasu commented 3 years ago

I still don't understand. In my experience synchronization works well if you just make sure that the ".notdeft-db" directory never gets synchronized. Each endpoint then has its own search index(es), which can be easily `notdeft-refresh'ed after a sync. It all works especially well if one has lots of small notes rather than fewer large ones, as that helps make synchronization conflicts less likely.

I don't quite see how the situation improves by putting ".notdeft-db" somewhere else. Is it that much more convenient to specify the database locations in Emacs Lisp than it is to add ".stignore" files?

harizvi commented 3 years ago

Sure, those are workarounds in my opinion. Someone syncing with Dropbox will have to find their approach, one with Google will have a different one, and so on. The requested change allows for a simpler, cleaner directory for syncing (and backup).

I'm fine if you decide to not implement it, it's not a major issue and I've a workaround. Thanks for notdeft!