journal icon indicating copy to clipboard operation
journal copied to clipboard

[Feature Request] Full text search

Open zeylos opened this issue 4 years ago • 6 comments

Hi there !

Just installed your app on FreeBSD today, was looking for a simple diary app and I'm very satisfied so far. Thanks for the good work ! I was wondering, do you plan to add a full text search feature ? I imagine something that could search in the title of the entry and/or in the text and show only the entries matching. If it could filter by date that'd be awesome too. Finally (for the hype) if the search box could be dynamic (something showing the X first hits while typing the research) that would be perfect ! Sadly I can't really help with the code as I don't know ruby at all...
However I can help with the installation docs if needed. Keep up the good job ! Best regards

zeylos avatar Jan 29 '20 22:01 zeylos

Full Text search would be harder because of the encrypted content - There is a way to do full-text search in Postgres that is pretty dang good, but the fact it's encrypted makes that hard.

PG does have some great decryption tools as well, but that'd require some work with exposing the encryption keys.

Other approach, design wise would be to dynamically build (and store in memory) a full text index using something like Picky, but that'd be super expensive - because you'd have to dynamically build the index on search time, which would be prohibitive.

Sutto avatar Aug 08 '20 09:08 Sutto

@zeylos Because of the constraints @Sutto called out (thanks!), I have no plans of implementing full text search. That being said, if your pain point is retroactively finding journal posts, I could add one/all of the following if you think it would solve your use case:

  1. A tagging system. The tag names could be unencrypted, and be essentially a proxy to text search on. I actually had this in the initial build and ripped it out because I never used it.
  2. Date filter as you suggested.

Let me know what you think!

inoda avatar Aug 08 '20 19:08 inoda

Hi, Thank you both for the clarification! I don't think I will use tags at all as I'm not used to it. Date filtering would be awesome, I'm thinking of something like "show me stuff I wrote between two dates" kind of filtering, but if you have something else in mind or if it's too complicated let me know what you have in mind.

Thanks a lot for your answers!

zeylos avatar Aug 09 '20 04:08 zeylos

Often cases, the database and app are hosted on the same place. It's text-only, there is no practical need to have the app and db on separate machines. The host is already trusted.

As I understand, there is nothing the end user provides as the encryption key — the app, server-side is currently responsible for encryption. Who has access to db has access to the app. You could advocate for backups and replication, but you can do that encrypted with both Postgres and external tools (such as restic).

Going full devil's advocate, in the somebody has access to the db, and not the app for some reason, they can still brute force it, or wait it out, a decade or so, when a vulnerability might be found. What I'd do with malicious intent: break the db: you will come to fix it, and likely at some point, the credentials are leaked / accessible.

You are overengineering it. What does encrypting the db give? Did I miss anything? Right now, it's standing in the way of a major feature, without giving any benefits.

jtagcat avatar Jan 14 '22 04:01 jtagcat

Just throwing in my perspective:

  1. A tagging system would be great.
  2. I think @jtagcat is spot on: Full text search of the titles and the content is a fantastic feature.

jlar0che avatar Feb 17 '22 13:02 jlar0che

Feel free to open a PR!

inoda avatar Feb 27 '22 01:02 inoda