diff --git a/src/calibre/db/backend.py b/src/calibre/db/backend.py index 389db05c84..82e6fb39df 100644 --- a/src/calibre/db/backend.py +++ b/src/calibre/db/backend.py @@ -1282,6 +1282,8 @@ class DB: def vacuum(self): self.execute('VACUUM') + if self.fts_enabled: + self.fts.vacuum() @property def user_version(self): diff --git a/src/calibre/db/fts/connect.py b/src/calibre/db/fts/connect.py index 6de2e37571..2912b0b7a1 100644 --- a/src/calibre/db/fts/connect.py +++ b/src/calibre/db/fts/connect.py @@ -20,7 +20,6 @@ from .pool import Pool from .schema_upgrade import SchemaUpgrade # TODO: calibre export/import should preserve indexed data -# TODO: check library and vacuuming of fts db def print(*args, **kwargs): @@ -80,6 +79,10 @@ class FTS: conn = self.get_connection() conn.execute('DELETE FROM fts_db.dirtied_formats') + def vacuum(self): + conn = self.get_connection() + conn.execute('VACUUM') + def remove_dirty(self, book_id, fmt): conn = self.get_connection() conn.execute('DELETE FROM fts_db.dirtied_formats WHERE book=? AND format=?', (book_id, fmt.upper()))