Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在写一个字典应用程序,需要在打字时做通常的单词提示。
LIKE somestring%相当慢(〜100k行表上〜1300ms)所以我转向FTS3。
LIKE somestring%
问题是,我还没有找到一种从字符串开头进行搜索的合理方法。 现在我正在执行类似的查询
SELECT word, offsets(entries) FROM entries WHERE word MATCH '"chicken *"';
,然后在代码中解析偏移量字符串。
有没有更好的选择?
是的,确保在字段上设置索引word并使用
word
word >= 'chicken ' AND word < 'chicken z'
而不是 LIKE 或 MATCH 或 GLOB