Automatically dirty existing books if FTS db is empty

Allows simply deleting the fts db file to force a rescan
This commit is contained in:
Kovid Goyal 2022-04-29 08:29:43 +05:30
parent 72f137c650
commit e40731ab34
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -40,6 +40,11 @@ class FTS:
SchemaUpgrade(conn)
conn.fts_dbpath = dbpath
conn.execute('UPDATE fts_db.dirtied_formats SET in_progress=FALSE WHERE in_progress=TRUE')
num_dirty = conn.get('''SELECT COUNT(*) from fts_db.dirtied_formats''')[0][0]
if not num_dirty:
num_indexed = conn.get('''SELECT COUNT(*) from fts_db.books_text''')[0][0]
if not num_indexed:
self.dirty_existing()
def get_connection(self):
db = self.dbref()