engine: Convert from SQLite FTS3/4 to FTS5 for full-text-search

Add SQL migration that drops the old FTS4 MessageSearchTable table,
re-create as a FTS5 table, clean up the column names a bit, and adds a
flags column so unread/starred queries can be made fast.

Define a SQLite FTS5 extension function `geary_matches()` to replace
the FTS3 `offsets()` function which no longer exists in FTS5, based on
Tracker's implementation.

Update code to FTS5 conventions (docid -> rowid, etc), use new column
names, populate and update the flags column as the email's flags
change, and use new match function for getting matching tokens.

Advanced searches are probably currently broken, these will be fixed
by subsequent commits.
This commit is contained in:
Michael Gratton 2020-11-04 00:55:13 +11:00 committed by Michael James Gratton
parent 435a5e90f4
commit 4fe0d92147
13 changed files with 266 additions and 63 deletions

View file

@ -74,8 +74,10 @@ Building Geary requires the following major libraries and tools:
See the `meson.build` file in the top-level directory for the complete
list of required dependencies and minimum versions.
Geary also requires SQLite to be built with the compiler flag
`-DSQLITE_ENABLE_FTS3`.
Geary requires SQLite is built with both FTS3 and FTS5 support. Ensure
`--enable-fts5`, `-DSQLITE_ENABLE_FTS3` and
`-DSQLITE_ENABLE_FTS3_PARENTHESIS` are passed to the SQLite configure
script.
All required libraries and tools are available from major Linux
distribution's package repositories: