问题
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:
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*';
来源:https://stackoverflow.com/questions/29159424/external-content-in-fts4-sqlite