Lurker News

Comments (189) 38 threads

Show all comments

Showing thread 1 of 38

phiresky6 replies#
Author of the referenced blog (and library) here. This is great!

The full text search engine in SQLite is sadly not really good for this - one reason is that it uses standard B-Trees, another is that it forces storing all token positions if you want BM25 sorting, which is a huge overhead for articles as long as Wikipedia's.
But that doesn't mean full text search isn't possible in a very efficient manner with statically hosted data! I wrote a proof of concept of making the Rust-based tantivy library work in the same way, which has a lot of internal things that can make the index much smaller and more efficient than SQLite's. It's also >10x faster in creating the search index.
Here's the demo also for Wikipedia: https://demo.phiresky.xyz/tmp-ytccrzsovkcjoylr/dist/index.ht... I'm not sure if it's more efficient than the SQlite version in this form, but it definitely has more upward potential and is more fun to work with.
And the corresponding draft PR: https://github.com/tantivy-search/tantivy/pull/1067
I sadly haven't gotten around to working on it more and writing an article about it.
Other people are also working on using this stuff to make Sci-hub and LibGen more available by using this in combination with IPFS for distributed and "uncensorable" hosting which is pretty awesome.
Edit: Just realized that the OP demo only searches in article titles, while mine searches in full article contents by default. You can search in only the titles in my demo by querying `title:harry title:potter`

segfall1 reply#
Thank you, Phiresky. My little side project only exists because of your work.
ignoramous#
Congrats on your side project! This wonderful discussion exists because of your work.
tored3 replies#
I have been thinking of using FTS5 with SQLite to search emails. Not close of 43 GB ofc, so I would probably not have any major performance problems, but still is FTS5 any good? Or should I look into other solutions?
OJFord#
Have you seen 'notmuch'? I was honestly shocked how good/fast it is. It uses a C (++?) lib called 'xapian' to provide the actual index/search capability.
psanford#
The nice thing about FTS5 is you can have full text search up and running on a dataset in a couple of minutes. So give it try and see if it is sufficient for your use case. If it is, great! If not, you've not wasted much time.
phiresky#
If you're talking about a normal local SQlite DB and your dataset is less than maybe 100GB of plaintext then SQLite FTS will work fine regarding performance.
walrus012 replies#
How does it do for performance if you throw the whole 43GB into RAM? Plenty of very affordable workstation systems out there today gently used with 128GB in them.
londons_explore4 replies#
You still have to download it all... Which is a barrier for most...
tjoff#
For English it states 90 GB uncompressed, doesn't say compressed size but that doesn't sound much larger than a large game. In the context I don't see it as a barrier.
tw04#
As someone who was very recently on about as bad of a dsl connection you could get... What? Outside of metered cellular connections this is available to basically everyone. Even the remotest parts of Africa have at least a handful of unmetered connections within a days drive and a USB drive.
unknownOrigin#
That's only a size of regular modern video game... the downloads of which are pretty mainstream these days. Saying that a 50 gig download is a barrier "for most" is definitely not true.
exdsq#
Gears of War 5 on the Xbox is 133GB with all its updates. I think we're at the point where 100GB is a high but reasonable request for people nowadays, at least in cities in the West.
shp0ngle1 reply#
what? the point of this is that it seeks just parts of the files through http ranges… not all 43 GB… just try the page? or am I missing something?
unixhero3 replies#
You're missing his pragmatic and creative solution to leapfrog the problem altogether.
IshKebab5 replies#
A pragmatic solution that requires users to have 43GB of RAM? Right.
unixhero5 replies#
2021 called, memory is cheap.
linkpuff1 reply#
Is it though? We are in the middle of a chip crisis where prices are raising to record levels...

Continue this thread — 1 reply

jbverschoor2 replies#
20 applications x 50GB = 1tb of memory.

Continue this thread — 2 replies

andi9993 replies#
Notebook vendors didn't get this memo.

Continue this thread — 3 replies

IshKebab#
And how many users have more than 16GB of RAM?
IgorPartola1 reply#
On phones too?
gsich1 reply#
Phones are not first class devices.
IgorPartola1 reply#
Says who?
gsich1 reply#
I do. Many others too. Or do you see books written on phones, programing being done on phones? Being able to install any program you like? No? Not first class then.

There are many things that can't be done on a phone that are possible on a PC. The reverse case is much harder.

IgorPartola1 reply#
I see Wikipedia being read on phones, which is the problem at hand.
gsich1 reply#
The fact that you can't even add memory (be it RAM or storage, the later one is of course doable on some devices) to your phone makes them not first class devices.
IgorPartola1 reply#
Same with MacBooks? Sorry this sounds like utter nonsense.

Continue this thread — 1 more reply

exdsq#
It's around £300 for 64GB of Corsair RAM - you need a motherboard that supports it but you can go cheap and you don't need a great processor. You could probably put this together for £600? It's not exactly crazy if this was for an office or something.
azeirah#
I mean sure it's for enthusiasts, but my 3 year old pc already has 32GB ram. It's definitely not out of the question
AussieWog93#
To put it in perspective, 43GB of RAM to browse the entirety of Wikipedia doesn't sound that ridiculous when popular Electron-based IM programs use 1GB+.
jggonz1 reply#
I'm going to upvote this comment because not everyone in the world can afford $300 for 64GB+ of RAM. The solution to not dump everything into RAM is a great one.

Fortunately, I've had a fancy Silicon Valley job for 15+ years which now lets me afford many GBs of RAM if I wanted to but it was a different story in my 20s. I relied on free or almost free hardware to learn. And that free hardware usually lagged in specs.

Continue this thread — 1 reply

bawolff#
Which problem?

Yes putting it in ram will be faster than downloading it over the network. I don't think anyone ever doubted that.
I imagine people who wanted to download it would just use kiwix. The potential to download isn't the part that makes this project interesting.

shp0ngle2 replies#
ahhh I misread his comments.

Sure, RAM is always faster.

Continue this thread — 2 replies

piyh1 reply#
Is there a dumbed down version of this indexing conversation for someone who understands b-trees, but BM25 or user space indexing?
peterhunt#
Well, this post is in the context of an e2e encrypted DB, but it's subject to the same constraints: https://medium.com/@ZeroDB_/scalable-full-text-search-over-e...

If you understand btrees you understand the hardest part already :)
Basically, you need to design a search index that examines the fewest DB pages in order to find the result. The Lucene scoring method stores a mapping of term -> document[] sorted in relevance order. The main idea is that you can examine only the first n documents for each term in the search query in order to find the most relevant search results. Picking n is sort of tricky, but if your index is stored in this way it's possible to fulfill a large % of queries efficiently without downloading the whole index.
Here's a little Python implementation of what I mean by a "user space implementation". Note that it's a toy but it performs pretty well on some demo sklearn data sets: https://gist.github.com/petehunt/724eeb77189332db101ad7b0db8...

dheera#
Yeah I was just thinking that. Why not just a static filesystem? Just mount a ext4 image full of .html files and browse away. It would be remarkably efficient, likely much more efficient than SQLite.
neocodesoftware#
how are the xml dumps generated?