Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

best_fts_version() cannot detect FTS5 #41

Closed
simonw opened this issue Nov 1, 2018 · 2 comments
Closed

best_fts_version() cannot detect FTS5 #41

simonw opened this issue Nov 1, 2018 · 2 comments

Comments

@simonw
Copy link
Owner

simonw commented Nov 1, 2018

Bug in this code:

def best_fts_version():
"Discovers the most advanced supported SQLite FTS version"
conn = sqlite3.connect(':memory:')
for fts in ('FTS5', 'FTS4', 'FTS3'):
try:
conn.execute('CREATE VIRTUAL TABLE v USING {} (t TEXT);'.format(fts))
return fts
except sqlite3.OperationalError:
continue
return None

In [5]: sqlite3.connect(":memory:").execute("CREATE VIRTUAL TABLE v USING FTS5 (text s)")
---------------------------------------------------------------------------
OperationalError                          Traceback (most recent call last)
<ipython-input-5-e28cb15a3bcb> in <module>()
----> 1 sqlite3.connect(":memory:").execute("CREATE VIRTUAL TABLE v USING FTS5 (text s)")
OperationalError: unrecognized column option: s
In [6]: sqlite3.connect(":memory:").execute("CREATE VIRTUAL TABLE v USING FTS5 (s)")
Out[6]: <sqlite3.Cursor at 0x102d761f0>

So FTS5 currently always fails to be detected.

@simonw
Copy link
Owner Author

simonw commented Nov 1, 2018

That said... I'm no longer convinced that just using the best available FTS version is the right approach. FTS4 is much more widely available, and FTS5 has quite a few differences. Maybe default to FTS4 and allow FTS5 to be explicitly requested via a command line option?

@simonw
Copy link
Owner Author

simonw commented Jun 24, 2019

I should definitely use FTS5 by default - it supports rank out of the box.

@simonw simonw closed this as completed in 705d5dd Jun 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant