mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-11-27 23:45:14 +00:00
Fix: flag recreated search index for reindex on next startup (#14877)
This commit is contained in:
1 parent
b0dea5a07d
commit
f775b94cd6
2 files changed
+24
-1
No files matched your search
@@ -387,9 +387,14 @@ def open_or_rebuild_index(index_dir: Path | None = None) -> tantivy.Index:
|
||||
logger.exception(
|
||||
"Search index is corrupted or incomplete. A new, empty index was "
|
||||
"created, but existing documents are not indexed yet. "
|
||||
"Run 'document_index reindex' to repopulate it.",
|
||||
"They will be reindexed on the next startup, or run "
|
||||
"'document_index reindex' to do so now.",
|
||||
)
|
||||
wipe_index(index_dir)
|
||||
idx = tantivy.Index(build_schema(), path=str(index_dir))
|
||||
_write_sentinels(index_dir)
|
||||
# The new index is stamped as current but is empty. Flag it so the next
|
||||
# `document_index reindex --if-needed` repopulates it. Reindexing here
|
||||
# would block whichever process happened to open the index first.
|
||||
(index_dir / REBUILD_MARKER).touch()
|
||||
return idx
|
||||
Reference in new issue
Block a user