question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SQL related question

See original GitHub issue

As 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:open
  • Created 5 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
AlecStrongcommented, Jun 1, 2018

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.

ConstraintLayout goes into fts as constraint layout

ConLa goes into search as con la

0reactions
JakeWhartoncommented, Jun 1, 2018

I think that was the original motivation for FTS so 👍

On Fri, Jun 1, 2018 at 9:06 AM Alec Strong notifications@github.com wrote:

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.

ConstraintLayout goes into fts as constraint layout

ConLa goes into search as con la

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/JakeWharton/SdkSearch/issues/100#issuecomment-393874511, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEEEZgg2lCylDw1r7ymgHmxsmVh2sipks5t4TxTgaJpZM4UUzRv .

Read more comments on GitHub >

github_iconTop Results From Across the Web

50 SQL Interview Questions and Answers for 2022 - Guru99
50 SQL Interview Questions and Answers for 2022 · 1. What is DBMS? · 2. What is RDBMS? · 3. What is SQL?...
Read more >
Top 115 SQL Interview Questions and Answers in 2023
SQL Interview Questions · Q1. What is the difference between SQL and MySQL? · Q2. What are the different subsets of SQL? ·...
Read more >
SQL Interview Questions CHEAT SHEET (2023) - InterviewBit
SQL Interview Questions · 1. What is Database? · 2. What is DBMS? · 3. What is RDBMS? How is it different from...
Read more >
Top 70+ SQL Interview Questions and Answers of 2022
Q2. What is DBMS and RDBMS? Explain the difference between them. Q3. What is SQL? Q4. What is normalization and its types?
Read more >
180+ SQL Interview Questions and Answers in 2023
The top 180+ SQL interview questions and answers of 2023 are for freshers and experienced professionals who get hired.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found