Android 全文 检索 Full Text Search 资料

用户反映app文本查询很慢

确实做程序的时候 也没多想 偷懒啦

文本查询 就一行接一行 做 indexOf 查询 比较慢。


不要自己开发全文检索啦(嘿嘿 不会) 

网上找了android全文检索的资料

主要是SQLite和android 支持

http://www.v2ex.com/2008/11/22/full-text-search/

http://bakhtiyor.com/2009/08/sqlite-full-text-search/

SQLite con­tains full-text search mod­ule called FTS3, using this mod­ule you can eas­ily add fast full text search to an Android appli­ca­tion.
First you need to cre­ate vir­tual table:


1. CREATE VIRTUAL TABLE TableName
2.     USING FTS3(ColOne TEXT, ColTwo DATETIME)

Your table must con­tains at least 1 TEXT field.
The FTS3 vir­tual table acts like a reg­u­lar table, but you need to man­u­ally main­tain the indexes to keep ref­er­en­tial integrity — you should UPDATE the FTS3 table from time to time.
The full-text query in SQLite looks like this:


1. SELECT * FROM TableName WHERE ColOne MATCH 'search phrase'
Make sure you use MATCH instead of equals or LIKE to scan a TEXT col­umn in a vir­tual table.

回头修改 哈哈

PS 某牛 发表的回复 中文支持不是太好
FTS3 needs to be hacked to support splitting chinese texts.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/86970/viewspace-622856/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/86970/viewspace-622856/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值