Android Sqlite FTS3 how to select words that start with?
For example, if I have these records
word
AAA
AAB
AAC
BAA AA
With a normal table, I would use sql like
select * from table where word like 'AA%'order by H collate nocase asc
How do I choose instead of the FTS3 table? Also I would like to know if FTS3 will still have better performance than a normal table with this type of query?
+3
source to share
1 answer
How do I choose instead of the FTS3 table?
Quoting the documentation :
The FTS table can be queried for all documents containing the specified term (simple example described above) or for all documents containing a term with the specified prefix. As we've seen, a query expression for a specific term is just the term itself. The query expression used to find the prefix of a term is the prefix itself with a '*' attached to it.
The documentation also provides an example:
-- Query for all documents containing a term with the prefix "lin". This will match
-- all documents that contain "linux", but also those that contain terms "linear",
--"linker", "linguistic" and so on.
SELECT * FROM docs WHERE docs MATCH 'lin*';
+1
source to share