diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-01-19 15:51:21 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-01-19 15:51:21 +0100 |
commit | 266836701081d674db486ebf70d8a3960493a9fc (patch) | |
tree | 60043b09fb91643e302e6ecb69d30a1dbb3ce60b /ishtar_common/management/commands/update_search_vectors.py | |
parent | 1da5669b4e24621d43a1e6c9c7a519e180a9e302 (diff) | |
download | Ishtar-266836701081d674db486ebf70d8a3960493a9fc.tar.bz2 Ishtar-266836701081d674db486ebf70d8a3960493a9fc.zip |
Improve search vector indexation
Diffstat (limited to 'ishtar_common/management/commands/update_search_vectors.py')
-rw-r--r-- | ishtar_common/management/commands/update_search_vectors.py | 7 |
1 files changed, 5 insertions, 2 deletions
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") |