lemon24 / reader

A Python feed reader library.
https://reader.readthedocs.io
BSD 3-Clause "New" or "Revised" License
456 stars 38 forks source link

update_search() does not work if search database is missing #362

Closed lemon24 closed 1 day ago

lemon24 commented 1 week ago

update_search() does not work if search database is missing (e.g. when trying to use a backup.sh database).

>>> reader = make_reader('db.sqlite')
>>> ls -l db.sqlite*
-rw-r--r--  1 lemon  staff  168329216 Nov 15 09:54 db.sqlite
-rw-r--r--  1 lemon  staff       4096 Nov 15 09:54 db.sqlite.search
-rw-r--r--  1 lemon  staff      32768 Nov 15 09:54 db.sqlite.search-shm
-rw-r--r--  1 lemon  staff          0 Nov 15 09:54 db.sqlite.search-wal
>>> reader.is_search_enabled()
False
>>> reader.update_search()
>>> reader.is_search_enabled()
False
>>> reader.enable_search()
>>> reader.is_search_enabled()
True
>>> reader.update_search()
>>> ls -l db.sqlite*
-rw-r--r--  1 lemon  staff  168329216 Nov 15 09:54 db.sqlite
-rw-r--r--  1 lemon  staff       4096 Nov 15 09:54 db.sqlite.search
-rw-r--r--  1 lemon  staff      32768 Nov 15 09:54 db.sqlite.search-shm
-rw-r--r--  1 lemon  staff      32992 Nov 15 09:55 db.sqlite.search-wal

Disabling and then updating works:

>>> reader.disable_search()
>>> reader.update_search()
>>> ls -l db.sqlite*
-rw-r--r--  1 lemon  staff  172998656 Nov 15 09:58 db.sqlite
-rw-r--r--  1 lemon  staff  144502784 Nov 15 09:58 db.sqlite.search
-rw-r--r--  1 lemon  staff      32768 Nov 15 09:54 db.sqlite.search-shm
-rw-r--r--  1 lemon  staff    6138832 Nov 15 09:58 db.sqlite.search-wal