SQL related question
See original GitHub issueAs far as I understand fts4 gives no benefit when LIKE is used.
CREATE VIRTUAL TABLE item_index USING fts4(content TEXT);
...
SELECT item.*
FROM item_index
JOIN item ON (docid = item.id)
WHERE content LIKE '%' || ?1 || '%' ESCAPE '\'
FTS tables can be queried efficiently using SELECT statements of two different forms: Query by rowid. If the WHERE clause of the SELECT statement contains a sub-clause of the form “rowid = ?”, where ? is an SQL expression, FTS is able to retrieve the requested row directly using the equivalent of an SQLite INTEGER PRIMARY KEY index. Full-text query. If the WHERE clause of the SELECT statement contains a sub-clause of the form “<column> MATCH ?”, FTS is able to use the built-in full-text index to restrict the search to those documents that match the full-text query string specified as the right-hand operand of the MATCH clause. If neither of these two query strategies can be used, all queries on FTS tables are implemented using a linear scan of the entire table. If the table contains large amounts of data, this may be an impractical approach (the first example on this page shows that a linear scan of 1.5 GB of data takes around 30 seconds using a modern PC).
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (6 by maintainers)

Top Related StackOverflow Question
if we tokenize the input string on camel case then the query becomes
MATCH 'con AND la'which would work.I dont think we can build actual sqlite tokenizers through the exposed android sqlite stuff, but we can tokenize from the kotlin side and this should all theoretically work.
ConstraintLayoutgoes into fts asconstraint layoutConLagoes into search ascon laI think that was the original motivation for FTS so 👍
On Fri, Jun 1, 2018 at 9:06 AM Alec Strong notifications@github.com wrote: