News for hackers. Stuff that matters.
Re:Show HN: Instantly search 28M books from OpenLibrary by adenta on Monday December 14, 2020 @09:11AM (#25417692)
Is such a thing possible? Yes.

Has anybody built it? No :(.

That would totally be the dream though. No reindexing. Pg_search is def fast enough for a large swath of use cases.

What I do is I’ve built a real barebones search controller that connects to Postgres. My controller only lets you search on one attribute, and I use it for autocompletes. Anything more involved, I use typesense.

Re:Show HN: Instantly search 28M books from OpenLibrary by karterk on Monday December 14, 2020 @09:36AM (#25417997)
As I posted in another comment [1], the biggest problem is handling updates and deletes. Requires that you do some kind of logical deletion with an `last_updated_at` timestamp to fetch updates from a primary table.

[1] https://news.ycombinator.com/item?id=25417856

Re:Show HN: Instantly search 28M books from OpenLibrary by adenta on Monday December 14, 2020 @09:56AM (#25418238)
I don't quite follow. For a system reliant entirely on Postgres, you can just fetch the records, and join them in real time, no? It would be much slower than elasticsearch, but still _good enough_ for a lot of use cases.
Re:Show HN: Instantly search 28M books from OpenLibrary by karterk on Monday December 14, 2020 @10:04AM (#25418339)
I was referring to an integration between Postgres and an external search system such that the data sync is automated. That was what the parent comment was asking about (I think).
Re:Show HN: Instantly search 28M books from OpenLibrary by adenta on Monday December 14, 2020 @11:10AM (#25419149)
Ahh, I understand, this is my mistake.

What I really want is an integration between Instantsearch.js, and Postgres.

Typesense has written a custom adapter for Instantsearch & Typesense. I would love to just hook Instantsearch up to directly to my rails all. You could use pg_search to get 90% of the value, with next to no complexity on the backend.

Re:Show HN: Instantly search 28M books from OpenLibrary by necovek on Monday December 14, 2020 @09:42AM (#25418067)
Never tried it out (it's on my never-getting-done list), but someone has built it: https://github.com/zombodb/zombodb