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 | 635020aa3e046e7f4e3c2fa110683b39eebaf9c7 (patch) | |
| tree | 60043b09fb91643e302e6ecb69d30a1dbb3ce60b /ishtar_common/management/commands | |
| parent | cc1eb217bd22da8fcad3bc0fd785a6889e0be157 (diff) | |
| download | Ishtar-635020aa3e046e7f4e3c2fa110683b39eebaf9c7.tar.bz2 Ishtar-635020aa3e046e7f4e3c2fa110683b39eebaf9c7.zip | |
Improve search vector indexation
Diffstat (limited to 'ishtar_common/management/commands')
| -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") | 
