diff --git a/pandora/annotation/models.py b/pandora/annotation/models.py index 51b08770..7fa4ff05 100644 --- a/pandora/annotation/models.py +++ b/pandora/annotation/models.py @@ -72,7 +72,7 @@ def get_matches(obj, model, layer_type, qs=None): name = name.lower() name = ox.decode_html(name) name = unicodedata.normalize('NFKD', name).lower() - if name in value and (exact or re.compile('((^|\s)%s([\.,;:!?\'"\)\]\-\/\s]|$))'%re.escape(name)).findall(value)): + if name in value and (exact or re.compile('((^|\s)%s([\.,;:!?\'"\)\]\-\/\s]|$))' % re.escape(name)).findall(value)): matches.append(a.id) break if not matches: @@ -96,7 +96,7 @@ class Annotation(models.Model): layer = models.CharField(max_length=255, db_index=True) value = models.TextField() - findvalue = models.TextField(null=True) + findvalue = models.TextField(null=True, db_index=settings.DB_GIN_TRGM) sortvalue = models.CharField(max_length=1000, null=True, blank=True, db_index=True) languages = models.CharField(max_length=255, null=True, blank=True) diff --git a/pandora/item/management/commands/sqlfindindex.py b/pandora/item/management/commands/sqlfindindex.py index 8a2cb77d..3823a83b 100644 --- a/pandora/item/management/commands/sqlfindindex.py +++ b/pandora/item/management/commands/sqlfindindex.py @@ -37,6 +37,7 @@ class Command(BaseCommand): for table, column in ( (models.ItemFind._meta.db_table, 'value'), # Item Find (models.Clip._meta.db_table, 'findvalue'), # Clip Find + (models.Annotation._meta.db_table, 'findvalue'), # Annotation Find (entity.models.Find._meta.db_table, 'value'), # Entity Find ): cursor = connection.cursor()