External content in FTS4 SQLITE

2019-05-10 02:01发布

I have a VIEW view_for_search_unit and a FTS4 table FTS_table_search_unit. I inserted data from view_for_search_unit into the FTS table using this command:

INSERT INTO FTS_table_search_unit(docId, name, description)
SELECT id, name, description FROM view_for_search_unit

After I check data in FTS table using this:

SELECT *FROM FTS_table_search_unit

it has 1000 perfect records(I use fake data). However, when I use the MATCH function in FTS:

SELECT * FROM FTS_table_search_unit WHERE FTS_table_search_unit MATCH 's*'

I retrieve 1000 records but all columns in the result are NULL. What is the problem? I can't understand because there is data in FTS_table_search_unit.

1条回答
老娘就宠你
2楼-- · 2019-05-10 02:44

Try docid instead of *:

SELECT docid FROM FTS_table_search_unit 
WHERE FTS_table_search_unit 
MATCH 's*'

or

SELECT v.* FROM FTS_table_search_unit s
INNER JOIN view_for_search_unit v ON s.docid = v.id
WHERE FTS_table_search_unit MATCH 's*';
查看更多
登录 后发表回答