Searching note content outside Zotero
Searching in Zotero will reveal which items contain the search terms, but not where in these items the matches are. This means that I will have to click through each matched item attachment and search again inside the attachment. In contrast, if I search a text document using
grep, it will return the line with the match and optionally any number of lines before and after the matching line. This is great for quickly finding relevant matches, and it would be very useful if I could search through Zotero’s notes and pdf-attachments in this way.
The PDF attachments are easy enough, I store them in a dedicated dir and could just run
pdftotext on them, just like Zotero does. However, it seems like the notes are only contained within the sqlite database, and not the Zotero storage directory like web snapshots and other files. This means I need to perform a sql query to dump all the note content to files (preferably with the parent item as the file name) and then convert from html to md using
pandoc. I am not familiar with the database structure of Zotero (or that much with sql either for that matter), would such as query be straightforward? Do you have any advice on where to start?