From 873dc44cb162f8cca320547090bfb1d85f9582c5 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Fri, 26 Jun 2020 00:36:26 +0000 Subject: [PATCH] Update whoosh migration script --- apiserver/migrate-whoosh-to-sqlite.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/apiserver/migrate-whoosh-to-sqlite.py b/apiserver/migrate-whoosh-to-sqlite.py index bd0c65c..f793ce3 100644 --- a/apiserver/migrate-whoosh-to-sqlite.py +++ b/apiserver/migrate-whoosh-to-sqlite.py @@ -8,11 +8,15 @@ archive.init() with archive.ix.searcher() as searcher: for docnum in searcher.document_numbers(): try: + if docnum > 500: + break + print('docnum', docnum) res = searcher.stored_fields(docnum) print('id', res['id']) - database.put(res['story']) + database.put_story(res['story']) + database.put_ref(res['story']['ref'], res['id']) print() - except: + except BaseException as e: print('skipping', docnum) - pass + print('reason:', e)