From 42c9186e91f0a60c66b37c2a3c159137b15e13ce Mon Sep 17 00:00:00 2001 From: jonaswinkler Date: Fri, 27 Nov 2020 13:56:07 +0100 Subject: [PATCH] refrain from creating the index as part of the migrations, messes with the test cases. --- docs/setup.rst | 18 +++++++++------- .../migrations/1000_update_paperless_all.py | 21 ------------------- 2 files changed, 10 insertions(+), 29 deletions(-) diff --git a/docs/setup.rst b/docs/setup.rst index 88785364b..4e2826dd6 100644 --- a/docs/setup.rst +++ b/docs/setup.rst @@ -265,15 +265,17 @@ Migration to paperless-ng is then performed in a few simple steps: ``docker-compose.env`` to your needs. See `docker route`_ for details on which edits are advised. -6. Start paperless-ng. +6. In order to find your existing documents with the new search feature, you need + to invoke a one-time operation that will create the search index: - .. code:: bash + .. code:: shell-session - $ docker-compose up + $ docker-compose run --rm webserver document_index reindex + + This will migrate your database and create the search index. After that, + paperless will take care of maintaining the index by itself. - If you see everything working (you should see some migrations getting - applied, for instance), you can gracefully stop paperless-ng with Ctrl-C - and then start paperless-ng as usual with +7. Start paperless-ng. .. code:: bash @@ -281,11 +283,11 @@ Migration to paperless-ng is then performed in a few simple steps: This will run paperless in the background and automatically start it on system boot. -7. Paperless installed a permanent redirect to ``admin/`` in your browser. This +8. Paperless installed a permanent redirect to ``admin/`` in your browser. This redirect is still in place and prevents access to the new UI. Clear browsing cache in order to fix this. -8. Optionally, follow the instructions below to migrate your existing data to PostgreSQL. +9. Optionally, follow the instructions below to migrate your existing data to PostgreSQL. .. _setup-sqlite_to_psql: diff --git a/src/documents/migrations/1000_update_paperless_all.py b/src/documents/migrations/1000_update_paperless_all.py index dc6313dd8..f3fbbb6c1 100644 --- a/src/documents/migrations/1000_update_paperless_all.py +++ b/src/documents/migrations/1000_update_paperless_all.py @@ -5,23 +5,6 @@ from django.db import migrations, models import django.db.models.deletion -def make_index(apps, schema_editor): - Document = apps.get_model("documents", "Document") - documents = Document.objects.all() - print() - try: - print(" --> Creating document index...") - from whoosh.writing import AsyncWriter - from documents import index - ix = index.open_index(recreate=True) - with AsyncWriter(ix) as writer: - for document in documents: - index.update_document(writer, document) - except ImportError: - # index may not be relevant anymore - print(" --> Cannot create document index.") - - def logs_set_default_group(apps, schema_editor): Log = apps.get_model('documents', 'Log') for log in Log.objects.all(): @@ -99,8 +82,4 @@ class Migration(migrations.Migration): code=django.db.migrations.operations.special.RunPython.noop, reverse_code=logs_set_default_group ), - migrations.RunPython( - code=make_index, - reverse_code=django.db.migrations.operations.special.RunPython.noop, - ), ]