Django full text поиск
TgUserMessage.objects.annotate(search=SearchVector('body')).filter(search='Cheese')
django.db.utils.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@@ plainto_tsquery('Cheese') = true LIMIT 21' at line 1")
В чем может быть проблема? Пример повторил из документации, пробовал на версии 7.4.5, 7.4.3 mysql
Пробовал ещё так (но вообще мне нужен SearchVector):
TgUserMessage.objects.filter(body_text__search='Cheese')
django.core.exceptions.FieldError: Unsupported lookup 'search' for TextField or join on the field not permitted.
Моя модель:
class TgUserMessage(models.Model):
tg_user = models.ForeignKey(TgUser, on_delete=models.CASCADE)
chat_id = models.IntegerField(db_index=True)
content_type = models.CharField(max_length=20)
body = models.TextField(max_length=4096, blank=True, null=True)