Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 2.27 KB

org-db.org

File metadata and controls

34 lines (26 loc) · 2.27 KB

org-db

This project aims to use a database (sqlite) to index org-files and provide search utilities that are superior to built-in org search. It isn’t a perfect solution, but it is often good enough. The gist of the idea is to use hook functions to index an org file any time it is saved, opened or closed. These hooks trigger functions that parse the org file and index different things, e.g. links, headlines, images, text, etc. Then, org-db provides search tools (using ivy as the completion backend) to find things by querying the database.

Features:

  • org element search
    • headline
    • links
    • properties
    • src-blocks
  • scimax objects
    • hashtags
    • files
    • locations
    • editmarks
    • email addresses
  • full text search
  • image search (text in images, requires tessaract for OCR)

Known issues

It isn’t perfect though:

  1. if you create, delete, or modify files outside of emacs, the hook functions don’t run, and the database will be out of sync. There are some functions to update the database, but the database can’t update files it doesn’t know about, and it is not cheap to scan your hard drive for new files.
  2. You might interrupt the indexing because you want to do some actual work… org-db tries to stay out of your way by only working in idle time, but sometimes you need to interrupt it.
  3. sqlite is not great on networked systems where multiple systems might read and write to it, e.g. I frequenly run into issues between home and work where the sqlite file is synced by Dropbox. Very often one site or the other has a read-only db, so no changes from that site are synced.
    1. This is extra problematic if the two sites have different paths to a file…

I don’t have good solutions to these issues. Issue 1 is a feature of the system; nothing stops you from doing this, and it could happen via git or other collaborative tools. I don’t think there is a file watch like solution; I don’t know a way to recursively watch a directory for nested file creation.

Issue 2 might be addressed with a fully asynchronous update system, but I am not presently interested in working that out.

Issue 3 might be addressed by using a proper db server like postgresql or mongodb, but this would add the complication of needing to set up a secure, accessible server.