SQLite3 FTS的坑

客户说,我的东西怎么搜索不到了?

zhanghd@ubuntu:~/sqlite/SQLite-036ebf72_orig_3.18.2$ ./sqlite3 vt.db
SQLite version 3.18.2 2017-06-17 09:59:36
Enter ".help" for usage hints.
sqlite> CREATE VIRTUAL TABLE vt USING fts4(n TEXT, c TEXT, n2 TEXT);
sqlite> insert into vt values('kiwi bird', '123 456 6789', 'dog');
sqlite> select n, c, n2 from vt where vt match 'n:cat* OR c:6789*';
kiwi bird|123 456 6789|dog
sqlite> select n, c, n2 from vt where vt match 'n:cat_* OR c:6789*';
sqlite> select n, c, n2 from vt where vt match 'c:6789* OR n:cat_*';
kiwi bird|123 456 6789|dog
zhanghd@ubuntu:~/sqlite/SQLite-036ebf72_orig_3.18.2$ ./sqlite3 vt.db 
SQLite version 3.18.2 2017-06-17 09:59:36
Enter ".help" for usage hints.
sqlite> CREATE VIRTUAL TABLE vt USING fts4(n TEXT, c TEXT, n2 TEXT, tokenize=icu);
sqlite> insert into vt values('kiwi bird', '123 456 6789', 'dog');
sqlite> select n, c, n2 from vt where vt match 'n:cat* OR c:6789*';
kiwi bird|123 456 6789|dog
sqlite> select n, c, n2 from vt where vt match 'n:cat_* OR c:6789*';
kiwi bird|123 456 6789|dog
sqlite> select n, c, n2 from vt where vt match 'c:6789* OR n:cat_*';
kiwi bird|123 456 6789|dog

posted @ 2018-11-25 00:06  seebigsea  阅读(1140)  评论(24编辑  收藏  举报