TWi*_*Rob 11 sqlite search android full-text-search fts3
我已经基于官方Android文档集成了搜索,我正在使用以下SQLite架构和查询:
CREATE VIRTUAL TABLE Search USING FTS3 (
_id,
name,
location
);
select * from Search where name MATCH ?
-- where ? is the user typed exact "query"
-- or if it doesn't have spaces or stars I append a star to search prefix: "query*"
Run Code Online (Sandbox Code Playgroud)
我想知道如何扩展它?允许以下内容:
说我有一些名为的物品:
当用户blah在搜索框中输入内容时,搜索结果会显示:
my
mfi
fan item,fanit,fit
it,item,im,itm
结果应根据匹配的好坏进行排名,例如,如果字母距离较远,则应排名低于完全匹配,例如mfi:"我喜欢的项目"应排在最后,"MFI thingy"应排在第一位(如果有这样的项目).
注意:我的min SDK是API级别10,这意味着它必须使用SQLite 3.6.22.
类似的功能主要在IDE中找到:
SQLite 的 FTS 只允许搜索整个单词或单词前缀。
没有像这样的模糊搜索的内置功能。(Android 数据库 API 不允许您添加自定义虚拟表实现。)
| 归档时间: |
|
| 查看次数: |
3887 次 |
| 最近记录: |