Sqlite Full Text Search Compression

浪尽此生 提交于 2019-12-08 07:26:52

问题


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:


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.



来源:https://stackoverflow.com/questions/20353327/sqlite-full-text-search-compression

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!