-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add new SQLite FTS5 full-text search backend #1241
Conversation
overhacked
commented
Oct 9, 2023
- WIP: add sqlite search backend boilerplate
- Introduce SQLite FTS5-powered search backend
Great idea! I was thinking about doing this myself too but you beat me to it.
|
Let me know when you're ready for final review and I'll test/merge it! |
I tested this on my "prod" dataset, and the index it created was huge at 1GB, 30% of the size of the I thought about and experimented with several approaches to this, and I think the best approach is to (very loosely) parse I think that Sonic doesn't have this problem because it limits maximum term length, but FTS5 doesn't have a configuration option for maximum (or minimum) term length. Or, maybe it's just the overall |
Use SQLite's FTS5 extension to power full-text search without any additional dependencies. FTS5 was introduced in SQLite 3.9.0, [released][1] in 2015 so should be available on most SQLite installations at this point in time. [1]: https://www.sqlite.org/changes.html#version_3_9_0
Retry with table creation should fail if it is attempted for a second time.
`connection` could cause confusion with `django.db.connection` and `get_connection` is a better callable name.
Clean up error handling, and report a better error message on search and flush if FTS5 tables haven't yet been created. Add some mypy comments to clean up type-checking errors.
9d0fb21
to
1e604a1
Compare
If creating the FTS5 tables fails due to a known version incompatiblity, report the required version to the user.
Alright, @pirate, I think it's ready for a hard look. Thanks! |