Sqlite全文搜索压缩 [英] Sqlite Full Text Search Compression
问题描述
我在我的应用中实施了FTS,但尺寸太大。我想以某种方式压缩它。我在sqlite网站上阅读过这些内容:
- 创建一个以压缩格式存储数据的FTS4表。这个
- 假定标量函数zip()和unzip()已经被添加到数据库句柄中(或者
)。
CREATE VIRTUAL TABLE论文使用fts4(author,document,compress = zip,uncompress = unzip);
但我正在努力寻找这些标量函数的例子。如果有人可以提供一个例子,说明我可以如何实现这种压缩文本的功能。
文本将以英文开头,但最终将包含阿拉伯文。
更新
由于似乎不可能压缩FTS表。我想限制生成的实际令牌,这会导致更小的尺寸。
例如,单词Book将AFAIK存储为Book Boo Bo B等。我只需要将其存储为完整的单词,因为这是我所有的用户都会搜索的内容。
我该如何实现这一目标?
<即使你找到了压缩函数的例子(哪个出口!),Android中的SQLite也不支持用户定义的函数。
您找到的示例在Android中不起作用 - 至少在标准的Android设备中。
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?
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.
这篇关于Sqlite全文搜索压缩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!