Thank you @mekarpeles for helping me get access to the data quickly and giving me pointers about the schema. I should add - I built this in about 12 hours as a weekend project, so there might be some lurking issues. > Details about the Tech Stack: The dataset has ~28.6 million books and is indexed on Typesense [1], an open source alternative to Algolia/ElasticSearch that a friend and I are working on. The UI was built using the Typesense adapter for InstantSearch.js [2] and is a static site bundled using ParcelJS. The app is hosted on S3, with CloudFront for a CDN. The search backend is powered by a geo-distributed 3-node Typesense cluster running on Typesense Cloud [3], with nodes in Oregon, Frankfurt and Mumbai. Here's the source code: https://github.com/typesense/showcase-books-search [1] https://github.com/typesense/typesense [2] https://github.com/typesense/typesense-instantsearch-adapter [3] https://cloud.typesense.org
The typesense performance is really impressive, seems at par with the (also) impressive meilisearch.
I'm going to try the free tier of typesense right now, perfect for my current use-case of site-search. How large is the dataset for the books?
How large nodes are needed?
The OpenLibrary dataset has ~28M records, takes up 6.8GB on disk and 14.3GB in RAM when indexed in Typesense. Each node has 4vCPUs. Took me ~3 hours to index these 28M records. Could have probably been done in ~1.5hrs - most of the indexing time was because of cross-region latency between the 3 geo-distributed nodes in Oregon, Mumbai and Frankfurt.
There are some issues with ranking and duplicates that I see. I typed "Neal Stephenson" and got lots of duplicates for his latest novels. Cleaning up the data might be necessary to fix this. It seems biased towards newer/recent titles. The ranking is also a bit tricky. If you type "Orwell" you get top results about George Orwell, rather than the book that made him famous (1984). I suspect this will be an issue with many literature works that will have a lot of books talking about these books. Spelling correction is kind of working but surfaces a lot of noise as well. E.g. Neal Stevenson just surfaces a lot of titles and authors with either Neal or Stevenson in them. But impressively it did find one Neal Stephenson title. Building good search and ranking is hard. So, not bad for a 12 hour effort.
I didn’t seem to find a popularity metric in the dataset, which would have solved the issue you pointed out about literary work having books written about them. I’ve left the typo correction settings to be a little loose, so need to reduce its aggressiveness. I’ll fix that.
I love to see this, more access for the book community -- especially how quickly it came together. Nice work Jabo and excited to see Typesense in action. Open Library gladly & thankfully tweeted its support of your hard work: https://twitter.com/openlibrary/status/1338531822536310789 In every intention of being additive to Jabo's work, thought I'd share a few resources folks may not be aware of: 1. Open Library's Full-text Search Major hat tip to the Internet Archive's Giovanni Damiola for this one: Folks may also appreciate the ability to full-text search across 4M of the Internet Archive's books on Open Library: https://blog.openlibrary.org/2018/07/14/search-full-text-wit.... You can try it directly here: http://openlibrary.org/search/inside?q=thanks%20for%20all%20... As per usual, nearly all Open Library urls are themselves APIs, e.g.:
http://openlibrary.org/search/inside.json?q=thanks%20for%20a... 2. Open Library's search API By adding .json to our search endpoint, you can use Open Library's json search endpoint (which also contains bookcover links). You can also use this to fetch books by ISBN: http://openlibrary.org/search.json?q=isbn:9781400067824 3. Book Cover Service (has issues) We need to improve our cover service, it's definitely been neglected, but the cover IDs from our data dump, solr search index, and book APIs can be plugged in to our cover store to point to or fetch book covers. We don't yet have a current data bulk dump of covers available (it's on the roadmap) but if you need "all" the covers, please email us openlibrary@archive.org instead of hitting covers 1-by-1. https://openlibrary.org/dev/docs/api/covers 4. The new (unannounced) Open Library Explorer I'm honestly kind of hoping no one reads this far into the comments because we haven't announced this one yet and I'm sure there are major performance issues (it's beta), but cdrini recently added dewey + library of congress classifications to our search index... Making this masterpiece possible: https://openlibrary.org/explore The ability to browse Open Library digitally, with all the glory of a physical library.
Straight up impossible for me to search for Isaac Asimov's "I, Robot". Some kinda of input cleaning strips out the I from "I robot", and just searches "Robot". "iRobot" does not get the results. And the search does not accept commas. Just some of the fun that comes with searching I suppose.
It also strips quotation marks, so can't search phrases at all.
I'm always sort of surprised by this stuff. Like, isn't 99% of the effort to get access to the database, how to search it efficiently, how to display useful snippets? Why go to all that effort and not take a useful search syntax off the shelf?
> I built this in about 12 hours as a weekend project, so there might be some lurking issues. > Yup, exact matching using quotes is on the horizon. Should be available in a few weeks. > Looks like I’m filtering a little too aggressively which is affecting the results, I’ll take a closer look it in a few hours.
Can someone explain why using quotes is a thing that has to be added? Like, it treats words separately by breaking up the search string into tokens using spaces as a delimiter. Is the OP implementing this himself? I would have imagined there's a standard library for converting search strings into a structured query.
Cool! Small bit of feedback: typing each character adds an entry to the browser's history which seems a bit excessive. Might consider using replaceState over pushState.
One usability feedback: The small OpenLibrary icon in the results looks a little bit like a trashcan. So after searching I was unsure what to do: I didn't want to got to Amazon nor would I want to trash a result.
Suggestion: Link the red book title to the OpenLibrary page.
Comments (80) 22 threads
Thank you @mekarpeles for helping me get access to the data quickly and giving me pointers about the schema.
I should add - I built this in about 12 hours as a weekend project, so there might be some lurking issues.
> Details about the Tech Stack:
The dataset has ~28.6 million books and is indexed on Typesense [1], an open source alternative to Algolia/ElasticSearch that a friend and I are working on.
The UI was built using the Typesense adapter for InstantSearch.js [2] and is a static site bundled using ParcelJS.
The app is hosted on S3, with CloudFront for a CDN.
The search backend is powered by a geo-distributed 3-node Typesense cluster running on Typesense Cloud [3], with nodes in Oregon, Frankfurt and Mumbai.
Here's the source code: https://github.com/typesense/showcase-books-search
[1] https://github.com/typesense/typesense
[2] https://github.com/typesense/typesense-instantsearch-adapter
[3] https://cloud.typesense.org
I'm going to try the free tier of typesense right now, perfect for my current use-case of site-search.
How large is the dataset for the books? How large nodes are needed?
The OpenLibrary dataset has ~28M records, takes up 6.8GB on disk and 14.3GB in RAM when indexed in Typesense. Each node has 4vCPUs. Took me ~3 hours to index these 28M records. Could have probably been done in ~1.5hrs - most of the indexing time was because of cross-region latency between the 3 geo-distributed nodes in Oregon, Mumbai and Frankfurt.
Is the indexed size 6.8GB or 14.3GB?
Continue this thread — 1 reply
Well done!
There are some issues with ranking and duplicates that I see. I typed "Neal Stephenson" and got lots of duplicates for his latest novels. Cleaning up the data might be necessary to fix this. It seems biased towards newer/recent titles.
The ranking is also a bit tricky. If you type "Orwell" you get top results about George Orwell, rather than the book that made him famous (1984). I suspect this will be an issue with many literature works that will have a lot of books talking about these books.
Spelling correction is kind of working but surfaces a lot of noise as well. E.g. Neal Stevenson just surfaces a lot of titles and authors with either Neal or Stevenson in them. But impressively it did find one Neal Stephenson title.
Building good search and ranking is hard. So, not bad for a 12 hour effort.
I didn’t seem to find a popularity metric in the dataset, which would have solved the issue you pointed out about literary work having books written about them.
I’ve left the typo correction settings to be a little loose, so need to reduce its aggressiveness. I’ll fix that.
I love to see this, more access for the book community -- especially how quickly it came together. Nice work Jabo and excited to see Typesense in action.
Open Library gladly & thankfully tweeted its support of your hard work:
https://twitter.com/openlibrary/status/1338531822536310789
In every intention of being additive to Jabo's work, thought I'd share a few resources folks may not be aware of:
1. Open Library's Full-text Search
Major hat tip to the Internet Archive's Giovanni Damiola for this one: Folks may also appreciate the ability to full-text search across 4M of the Internet Archive's books on Open Library: https://blog.openlibrary.org/2018/07/14/search-full-text-wit.... You can try it directly here: http://openlibrary.org/search/inside?q=thanks%20for%20all%20...
As per usual, nearly all Open Library urls are themselves APIs, e.g.: http://openlibrary.org/search/inside.json?q=thanks%20for%20a...
2. Open Library's search API
By adding .json to our search endpoint, you can use Open Library's json search endpoint (which also contains bookcover links). You can also use this to fetch books by ISBN:
http://openlibrary.org/search.json?q=isbn:9781400067824
3. Book Cover Service (has issues)
We need to improve our cover service, it's definitely been neglected, but the cover IDs from our data dump, solr search index, and book APIs can be plugged in to our cover store to point to or fetch book covers. We don't yet have a current data bulk dump of covers available (it's on the roadmap) but if you need "all" the covers, please email us openlibrary@archive.org instead of hitting covers 1-by-1. https://openlibrary.org/dev/docs/api/covers
4. The new (unannounced) Open Library Explorer
I'm honestly kind of hoping no one reads this far into the comments because we haven't announced this one yet and I'm sure there are major performance issues (it's beta), but cdrini recently added dewey + library of congress classifications to our search index... Making this masterpiece possible:
https://openlibrary.org/explore
The ability to browse Open Library digitally, with all the glory of a physical library.
Please do contribute to OpenLibrary in any way you can. Here are some ways how: https://news.ycombinator.com/item?id=25408744
I'm always sort of surprised by this stuff. Like, isn't 99% of the effort to get access to the database, how to search it efficiently, how to display useful snippets? Why go to all that effort and not take a useful search syntax off the shelf?
> I built this in about 12 hours as a weekend project, so there might be some lurking issues.
> Yup, exact matching using quotes is on the horizon. Should be available in a few weeks.
> Looks like I’m filtering a little too aggressively which is affecting the results, I’ll take a closer look it in a few hours.
Working on support for exact matches using quotes, which will also help here.
Suggestion: Link the red book title to the OpenLibrary page.
I just pushed out an update to link the title to the OpenLibrary page.
All comments shown.
Couldn't load more comments. Check your connection and try again.