Sqlite Full Text Search Compression

2019-06-05 21:39发布

I have implemented FTS in my app, but the size is too big. I would like to compress it somehow. I read this on the sqlite website:

-- Create an FTS4 table that stores data in compressed form. This
-- assumes that the scalar functions zip() and unzip() have been (or
-- will be) added to the database handle.
CREATE VIRTUAL TABLE papers USING fts4(author, document, compress=zip, uncompress=unzip);

But I am struggling to find an example of these scalar functions. Please if someone could provide an example of how I may implement such a function for compressing my text.

The text will be in english to start, but will eventually include arabic.

Update

Since it does not seem possible to compress the FTS tables. I would like to limit the actual tokens generated which would lead to smaller sizes.

For example the word "Book" will AFAIK be stored as Book Boo Bo B etc. However I only need it to be stored as complete words as that is all my users will search for.

How can I acheive that?

1条回答
男人必须洒脱
2楼-- · 2019-06-05 22:15

Even if you found a compression function example (which exit!), SQLite in Android doesn't support user defined functions.

Sample you found will not work in Android - at least in a standard Android device.

查看更多
登录 后发表回答