Searching the GnuPG encrypted org-journal
=========================================
To evaluate the performance of searching in the GnuPG-encrypted
org-journal, I created a small experiment.
Setting up the test data
------------------------
I created a small and simple Markov text generator in Common Lisp,
and let SBCL create org journal files.
I let it create a journal file for each day of the year 2023.
The file names are in the org-journal format, `YYYYMMDD.org'.
Each journal file consists of the normal org-journal headers:
* a line with a level one header, containing the date
* a line with a level two header, containing the time and a title
* a block of text
The title and the block of text are generated by the Markov text
generator, which I had first fed with the text of "Walden and on the duty of
civil disobedience" by Henry David Thoreau.
The size of the block of text in each journal file is 400 words.
Here is a small, shortened example:
* Monday, 2023-03-06
** 10:08 I had gone down
It is remarkable that _we_ know so much of them as we do. The same
is true of the more modern reformers and benefactors of their
race. None can be an impartial or wise observer of human life
seems to some to have been gone over by their predecessors, both
the heights and the valleys, and all things to have been and were
severely punished under the name of Plato and never read his book?
As if Plato little can be ....
Encrypting the journal files
----------------------------
Next I encrypted the journal files, this is easy:
gpg --encrypt-files --recipient <GnuPG-key> *org
This creates a number of files, with the file name in the format
`YYYYDDMM.org.gpg'. After this, a small shell-script renamed
the file in the format `YYYYDDMM.gpg'.
Performing the search
---------------------
I moved the files to the sub directory `2023' within the org-journal
directory.
Next I started org-journal-search, using "modern reformers" as search
argument and 2023-01-01 ... 2023-12-31 as search period.
The search-argument "modern reformers" was chosen because it occurs
in 20 journal files, spread out over the year.
The search runs through all journal files, starting with 20230101.gpg
and ending with 20231231.gpg, and is done is less than two minutes.
Conclusion
----------
I was afraid that adopting encryption would limit the search
functionality, and I devised the test to get this out of the way.
The test results took away my concerns.
Although the search is not instantaneous, it is certainly usable.
Using encryption of course comes with some trade-offs.
Org-journal has to decrypt each file to perform the search. When the
search text occurs in multiple files in the search-period, the result
buffer will list them all, and it is easy to walk through this list.
Hit enter to update the second buffer that shows the complete journal
entry of the chosen file.
The time it takes to perform the search is proportional to the length
of the search period.
In practice, when you want to search in your journal, you can often
reduce the search period. Searching in the last two months will takes
considerably less time than in the whole year.