From 266836701081d674db486ebf70d8a3960493a9fc Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 19 Jan 2018 15:51:21 +0100 Subject: Improve search vector indexation --- ishtar_common/management/commands/update_search_vectors.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'ishtar_common/management') diff --git a/ishtar_common/management/commands/update_search_vectors.py b/ishtar_common/management/commands/update_search_vectors.py index c73a6e88e..d301a3afc 100644 --- a/ishtar_common/management/commands/update_search_vectors.py +++ b/ishtar_common/management/commands/update_search_vectors.py @@ -14,11 +14,14 @@ class Command(BaseCommand): def handle(self, *args, **options): for model in django.apps.apps.get_models(): if hasattr(model, "update_search_vector") and \ - getattr(model, "BASE_SEARCH_VECTORS", None): + (getattr(model, "BASE_SEARCH_VECTORS", None) or + getattr(model, "INT_SEARCH_VECTORS", None) or + getattr(model, "M2M_SEARCH_VECTORS", None) or + getattr(model, "PARENT_SEARCH_VECTORS", None)): self.stdout.write("\n* update {}".format(model)) total = model.objects.count() for idx, item in enumerate(model.objects.all()): - sys.stdout.write("\r{}/{} ".format(idx, total)) + sys.stdout.write("\r{}/{} ".format(idx + 1, total)) sys.stdout.flush() item.update_search_vector() self.stdout.write("\n") -- cgit v1.2.3