Update whoosh migration script

This commit is contained in:
Tanner Collin 2020-06-26 00:36:26 +00:00
parent 1fb9db3f4b
commit 873dc44cb1

View File

@ -8,11 +8,15 @@ archive.init()
with archive.ix.searcher() as searcher: with archive.ix.searcher() as searcher:
for docnum in searcher.document_numbers(): for docnum in searcher.document_numbers():
try: try:
if docnum > 500:
break
print('docnum', docnum) print('docnum', docnum)
res = searcher.stored_fields(docnum) res = searcher.stored_fields(docnum)
print('id', res['id']) print('id', res['id'])
database.put(res['story']) database.put_story(res['story'])
database.put_ref(res['story']['ref'], res['id'])
print() print()
except: except BaseException as e:
print('skipping', docnum) print('skipping', docnum)
pass print('reason:', e)