I'm developing an Android application that has to perform substring search in a large table (about 500'000 entries with street and location names, so just a few words per entry).
CREATE TABLE Elements (elementID INTEGER, type INTEGER, name TEXT, data BLOB)
Note that only 20% of all entries contain strings in the "name" column.
Performing the following query almost takes 2 minutes:
SELECT elementID, name FROM Elements WHERE name LIKE %foo%
I now tried to use FTS3 in order to speed up the query. That was quite successful, query time decreased to 1 minute (surprisingly the database file size increased by only 5%, which is also quite good for my purpose).
The problem is, FTS3 seemingly doesn't support substring search, i.e. if I want to find "bar" in "foo bar" and "foobar", I only get "foo bar", although I need both results.
So actually I have two questions:
Is it possible to further speed up the query? My goal is 30 seconds for the query, but I don't know if that's realistic...
How can I get real substring search using FTS3?