Where Are Notes Stored?

Could you tell me which file or files notes are stored in in %appdata%? I’d like to try indexing them so that they show up in general searches.

Notes are stored in your project (*.tpy) files which are in SQLite 3 format.

1 Like

As @flachware says, all notes are stored in the project database. Notes are stored using an internal document model (they’re converted to HTML, Markdown, or similar at the application level) but also as plain-text (specifically for indexing purposes). For this reason it’s quite easy to extract the note text contents, but if you’re indexing this outside of Tropy all notes will still point to project file.

What might be more useful, is to extract the notes and the item and photo ids. With this, you could create tropy:// URLs for each note. Opening such a URL would start Tropy, showing the corresponding note. Currently, Tropy URLs all operate on the most recently used project file but we’re going to add an option to add project files using a full path or name alias soon. Do you think this would be an option for you? That is, you could index each note content to a URL which opens the note in Tropy.

I’m coming back to this after a long time. To index my library, I’m using DocFetcher Pro, which does a phenomenally better job than Windows Search. I’ve set it to interpret TPY files (which it doesn’t, by default, know how to index) as plain-text files. I’ve found that it can index notes and tags this way but not item creators (dc:creator) or item titles (dc:title). Do you know why that might be?

I’d need to have a script running in the background that periodically exports my content to separate files per item, right? Maybe a *.url or *.lnk file (I’m using Windows—I think these extensions would be different with macOS) containing the data I want indexed as well as a tropy:// URL pointing to that particular item?

The TPY file is a Sqlite3 database; generally, you should be able to find all strings in that file by interpreting it as a text file. However, the formatting for individual metadata values will be tricky, looking over my own project files for example, I see that the values are generally saved together with the type. So for instance, a value ‘Author’ for dc:creator would probably appear as the string ‘http://purl.org/dc/elements/creatorAuthor’.

It would be ideal if DocFetcher would allow you to pre-process files before indexing them. If you have sqlite3 installed, you could extract all notes and metadata values very easily like this:

sqlite3 [path/to/tpy] "select distinct text from notes union select distinct text from metadata_values"

The output of this command would simply be all note and metadata contents as plain text.

1 Like