SQLite FTS3 simulates LIKE somestring%

I am writing an application for dictionaries and you need to make an ordinary word suggesting during input.

LIKE somestring% rather slow (~ 1300 ms in the row table ~ 100 thousand), so I switched to FTS3.

The problem is that I did not find a reasonable way to search from the beginning of the line.
Now I am executing a query like

 SELECT word, offsets(entries) FROM entries WHERE word MATCH '"chicken *"'; 

then parse the offset string in code.

Are there any better options?

+6
android sqlite fts3
source share
1 answer

Yes , be sure to set the index in the word field and use

 word >= 'chicken ' AND word < 'chicken z' 

instead of LIKE or MATCH or GLOB

+6
source share

All Articles