mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
make the index dir if it does not exist.
This commit is contained in:
parent
1655d85a53
commit
2c9555015b
@ -1,6 +1,8 @@
|
|||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
from whoosh import highlight
|
from whoosh import highlight
|
||||||
from whoosh.fields import Schema, TEXT, NUMERIC
|
from whoosh.fields import Schema, TEXT, NUMERIC
|
||||||
from whoosh.highlight import Formatter, get_text
|
from whoosh.highlight import Formatter, get_text
|
||||||
@ -8,7 +10,6 @@ from whoosh.index import create_in, exists_in, open_dir
|
|||||||
from whoosh.qparser import MultifieldParser
|
from whoosh.qparser import MultifieldParser
|
||||||
from whoosh.writing import AsyncWriter
|
from whoosh.writing import AsyncWriter
|
||||||
|
|
||||||
from paperless import settings
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = 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
|
# TODO: this is not thread safe. If 2 instances try to create the index
|
||||||
# at the same time, this fails. This currently prevents parallel
|
# at the same time, this fails. This currently prevents parallel
|
||||||
# tests.
|
# 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())
|
return create_in(settings.INDEX_DIR, get_schema())
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user