From ddeee8f73d2171dada26e7bc9fb41e72138b361a Mon Sep 17 00:00:00 2001 From: Lova ANDRIARIMALALA <43842786+Xpirix@users.noreply.github.com> Date: Mon, 13 Nov 2023 11:45:05 +0300 Subject: [PATCH] Add command to fix none in search results --- INSTALL.md | 7 +++++++ dockerize/Makefile | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/INSTALL.md b/INSTALL.md index 1b607c93..5a5459eb 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -36,6 +36,13 @@ $ make devweb-runserver ``` and now, you can see your site at `http://0.0.0.0:62202` (skip this step if you are using PyCharm interpreter) +- If 'None' appears in the search results, it indicates a misalignment between the search index and the database. This discrepancy often arises when a plugin is deleted from the model but persists in the search index. To rectify this issue, it is essential to synchronize the search index with the database by rebuilding it. Execute the following command to initiate the rebuilding process: + +```bash +$ make rebuild_index +``` +This command ensures that the search index accurately reflects the current state of the database, resolving the presence of 'None' in the search results. Automatic synchronization is currently managed in settings.py: `HAYSTACK_SIGNAL_PROCESSOR = "haystack.signals.RealtimeSignalProcessor"`. + --- ### Setup git-hooks and local linting diff --git a/dockerize/Makefile b/dockerize/Makefile index 21311379..21838313 100644 --- a/dockerize/Makefile +++ b/dockerize/Makefile @@ -126,3 +126,10 @@ dbseed: @echo "Seed db with JSON data from /fixtures/*.json" @echo "------------------------------------------------------------------" @docker-compose -p $(PROJECT_ID) exec devweb bash -c 'python manage.py loaddata fixtures/*.json' + +rebuild_index: + @echo + @echo "------------------------------------------------------------------" + @echo "Rebuild search index in PRODUCTION mode" + @echo "------------------------------------------------------------------" + @docker-compose -p $(PROJECT_ID) exec web bash -c 'python manage.py rebuild_index'