A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
make the index dir if it does not exist.
Jonas Winkler2c9555015b7b
diff --git a/src/documents/index.py b/src/documents/index.pyindex d46ccedaf..ad3a50010 100644--- a/src/documents/index.py+++ b/src/documents/index.py@@ -1,6 +1,8 @@import logging+import osfrom contextlib import contextmanager+from django.conf import settingsfrom whoosh import highlightfrom whoosh.fields import Schema, TEXT, NUMERICfrom whoosh.highlight import Formatter, get_text@@ -8,7 +10,6 @@ from whoosh.index import create_in, exists_in, open_dirfrom whoosh.qparser import MultifieldParserfrom whoosh.writing import AsyncWriter-from paperless import settingslogger = logging.getLogger(__name__)@@ -69,6 +70,8 @@ def open_index(recreate=False):# TODO: this is not thread safe. If 2 instances try to create the index# at the same time, this fails. This currently prevents parallel# tests.+ if not os.path.isdir(settings.INDEX_DIR):+ os.makedirs(settings.INDEX_DIR, exist_ok=True)return create_in(settings.INDEX_DIR, get_schema())