Live data from Hacker News

SQLite FTS5 Extension

sqlite.org

51–60 of 61 posts

Re: SQLite FTS5 Extension

#51
post #14

Earlier quoted context omitted.

Eh? The tokenizers are fully pluggable, the Unicode and ICU tokenizers will be good for many purposes and you can always drop something specific in. Eg https://github.com/wangfenjin/simple

I know it’s extensible, with original work. ICU isn’t helpful for some languages

For what languages? Why ICU isn't helpful? My naive guess would be "it works for anything supported by Unicode".

Re: SQLite FTS5 Extension

#52
post #42

Earlier quoted context omitted.

though useless for many non english languages

Of all/many opensource projects I looked at, only meilisearch is good for non-English languages: https://www.meilisearch.com/docs/learn/resources/language

Unfortunately it still works very poorly for languages with compound words (German, Swedish, Finnish) where you would usually want to surface search results if someone uses the second or third part of the compound word, otherwise the user has to enumerate the (often too many) variants. Meilisearch doesn’t support suffix search and their tokenizer can’t handle these languages.

For instance searching for ‘___missilestrike’ in Kyiv would ideally surface all incidents, regardless of launch mode (surface-to-surface, air-to-surface…), range, propulsion, warhead, or guidance system. In these languages a number of these would form the prefix of that compound word.

Re: SQLite FTS5 Extension

#53
post #4

Does anyone have successfully worked with Non-English text with FTS5 in Sqlite? I could not find any reference for German, e.g. and the default stemming does not seem to work properly (given some short tests).

It has pretty much the same support for other languages as most text mining tools and Elasticsearch via the snowball stemmer: https://github.com/abiliojr/fts5-snowball

Should work well for German, I’m using it with Nordic languages.

Re: SQLite FTS5 Extension

#54

We are running FTS5 with a bunch of sqlite databases for an internal search tool, one with 15m records (we sharded that one, one shard per core), others with 200k-2m records. Speed is very fast -- the biggest dbs are hundreds of ms response time, but others are sub 10 or tens of ms. By _far_ the simplest search option for a small organization where a lot of the data is already in a SQL db, and we don't have the resou…

I’m interested in the sharding approach myself but those hundreds of ms sound a bit slow.

Do you have to do anything special to guarantee each sqlite instance executes in parallel with the others on its own core? Does the language you’re calling them from support concurrency or parallelism?

Re: SQLite FTS5 Extension

#55
post #28

Earlier quoted context omitted.

How’d it go?

GRDB on iOS and macOS It’s easy and works well It is slower than Realm in some benchmarking (I forget if it’s reads or writes) and might be less memory friendly (Realm does lazy evaluation). You need to use some third party open source to make sqlite faster by precompiling model definitions, which I didn’t bother with. I currently only use it for fts5 and Realm for other needs, but would like to try using it for more…

Thanks for the input! Did you need to ship your own binaries of sqlite that include fts5 or does skip do that for you?

Re: SQLite FTS5 Extension

#56
post #55

Earlier quoted context omitted.

GRDB on iOS and macOS It’s easy and works well It is slower than Realm in some benchmarking (I forget if it’s reads or writes) and might be less memory friendly (Realm does lazy evaluation). You need to use some third party open source to make sqlite faster by precompiling model definitions, which I didn’t bother with. I currently only use it for fts5 and Realm for other needs, but would like to try using it for more…

Thanks for the input! Did you need to ship your own binaries of sqlite that include fts5 or does skip do that for you?

I haven't used Skip yet, but the two founders are very responsive on twitter / elsewhere if you want to ask about that. I used GRDB for FTS5

Re: SQLite FTS5 Extension

#57

Earlier quoted context omitted.

I know it’s extensible, with original work. ICU isn’t helpful for some languages

For what languages? Why ICU isn't helpful? My naive guess would be "it works for anything supported by Unicode".

languages that don't use spaces like Japanese

Re: SQLite FTS5 Extension

#58
post #47

Earlier quoted context omitted.

Why not?

I need an offline client side db/ fts (for this language learning app: https://reader.manabi.io )

To my knowledge, meili is free software (MIT license) so theoretically, it should be possible to embed it to an IOS app.

Re: SQLite FTS5 Extension

#59
post #54

We are running FTS5 with a bunch of sqlite databases for an internal search tool, one with 15m records (we sharded that one, one shard per core), others with 200k-2m records. Speed is very fast -- the biggest dbs are hundreds of ms response time, but others are sub 10 or tens of ms. By _far_ the simplest search option for a small organization where a lot of the data is already in a SQL db, and we don't have the resou…

I’m interested in the sharding approach myself but those hundreds of ms sound a bit slow. Do you have to do anything special to guarantee each sqlite instance executes in parallel with the others on its own core? Does the language you’re calling them from support concurrency or parallelism?

I just did some tests and the perf is actually worse than that — but it’s actually still perfectly fine for our use cases.

- 15m row db will return a search for an extremely common term in ~3s (9m rows have that term);

- When adding terms, so that only ~200k rows have the combination, response is ~2s

- That 15m db was in 16 shards. (I’m actually not sure why it should be so slow; doesn’t actually make sense given that a single 1m row db is not that slow, might look into it but not a huge priority)

- For a ~200k row db, search is ~150ms for three terms that appear in ~1.5k entries

- Obviously the network io is the slower piece anyway

This perf is fine for our use case — a research system for internal users. Certainly worth the trade-off of not having to deal with a more complex database like elasticsearch, or even PG with the tantivy extension (which we might switch to some day).

For sharding — we only shard the huge one. To make sure bm25 rankings are still _roughly_ the same as they would be if we did not shard, we just randomised the rows assigned to the num_core shards. It’s a 16 core machine so 16 shards.

We know/ensure each db file gets its own core because we use aioprocessing in python. It handles both multicore and async. Running a query with htop shows all the cores light up (unlike with unsharded).

It’s all about trade-offs in the end. We cache the first search then pre cache the next page (and so on) so the user only has to wait 2-3s when searching the big db for that initial search and after that it’s pretty snappy. Most searches are on much smaller dbs (thousands to hundreds of thousands of rows) and results there are often 10ms or something. No user complaints so far.

Re: SQLite FTS5 Extension

#60
post #36

Earlier quoted context omitted.

Wait, why they revoked git access?

Someone unexpectedly ingesting all git repos at once would look a lot like a compromised workstation being used to harvest company data. I assume everything was fine once they explained what was going on.

Yes you're exactly correct. They were worried I'd had my laptop compromised or stolen but after a little bit of back and forth I think they just thought it was funny and restored my access
Post reply on HN