以下是我创建FTS表的方法:
CREATE virtual TABLE IF NOT EXISTS translationsfts using fts4(verse, surahnbr, versenbr, translator);INSERT INTO translationsfts
SELECT verse,
surahnbr,
versenbr,
translator
FROM translations
JOIN translators
ON translatorid = translators._id;
以下是我查询数据的方法:
SELECT DISTINCT verse,
surahnbr,
versenbr,
translator
FROM (
SELECT verse,
surahnbr,
versenbr,
translator,
1 AS rank
FROM translationsfts
WHERE verse match '"wherever* you*"'
UNION ALL
SELECT verse,
surahnbr,
versenbr,
translator,
2 AS rank
FROM translationsfts
WHERE verse match 'wherever* you*'
ORDER BY rank,
surahnbr,
versenbr)
问题是,在我的应用程序中,查询返回0结果(游标计数为零)。但是当我调试应用程序并手动提取查询(这是上面的第二个查询),然后在DB Browser for SQLite中输入它时,它返回400+结果。 Android有什么问题?