summaryrefslogtreecommitdiff
path: root/ishtar_common/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r--ishtar_common/models.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 66b15be34..86191c0ef 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -1030,7 +1030,9 @@ class FullSearch(models.Model):
:param save: True if you want to save the object immediately
:return: True if modified
"""
- if not self.BASE_SEARCH_VECTORS and not self.M2M_SEARCH_VECTORS:
+ if not self.BASE_SEARCH_VECTORS and not self.M2M_SEARCH_VECTORS \
+ and not self.INT_SEARCH_VECTORS \
+ and not self.PARENT_SEARCH_VECTORS:
logger.warning("No search_vectors defined for {}".format(
self.__class__))
return
@@ -1073,13 +1075,14 @@ class FullSearch(models.Model):
else:
search_vectors.append(parent.search_vector)
- # query "simple" fields
- q = base_q.annotate(
- search=SearchVector(
- *self.BASE_SEARCH_VECTORS,
- config=settings.ISHTAR_SEARCH_LANGUAGE
- )).values('search')
- search_vectors.append(q.all()[0]['search'])
+ if self.BASE_SEARCH_VECTORS:
+ # query "simple" fields
+ q = base_q.annotate(
+ search=SearchVector(
+ *self.BASE_SEARCH_VECTORS,
+ config=settings.ISHTAR_SEARCH_LANGUAGE
+ )).values('search')
+ search_vectors.append(q.all()[0]['search'])
self.search_vector = merge_tsvectors(search_vectors)
changed = old_search != self.search_vector
if save and changed: