SQLite的全文检索

来源:互联网 发布:linux kernel debug 编辑:程序博客网 时间:2024/04/29 11:52

如果需要在其中做全文检索的话,也是可以的。因为sqlite中支持fts表

这里的FTS3其实是sqlite的一个扩展模块,是虚拟表模块,允许用户去实现全文检索。

下面是一个简单的例子:

create virtual table test using fts3(content text);     

表建立以后sqlite还会自动创建3个表:test_content、test_segdir、test_segments。

/* 关键词 */ select count(*) from test where content match 'farmer';/* 支持通配符 */ select count(*) from test where content match 'far*';/* 支持匹配哪一行 */select * from test where content match 'content:1231*';

还有什么用法可以以后再加 感觉应该会用到的,做个记号。