mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-10-05 07:40:31 +00:00
Fix: rebuild the search index automatically when it is corrupted, instead of hard-failing (#14180)
This commit is contained in:
@@ -337,4 +337,13 @@ def open_or_rebuild_index(index_dir: Path | None = None) -> tantivy.Index:
|
||||
idx = tantivy.Index(build_schema(), path=str(index_dir))
|
||||
_write_sentinels(index_dir)
|
||||
return idx
|
||||
return tantivy.Index.open(str(index_dir))
|
||||
try:
|
||||
return tantivy.Index.open(str(index_dir))
|
||||
except ValueError:
|
||||
logger.exception(
|
||||
"Search index is corrupted or incomplete - rebuilding from scratch.",
|
||||
)
|
||||
wipe_index(index_dir)
|
||||
idx = tantivy.Index(build_schema(), path=str(index_dir))
|
||||
_write_sentinels(index_dir)
|
||||
return idx
|
||||
|
||||
Reference in New Issue
Block a user