Hello, I'm trying to make the text search index like this: https://www.postgresql.org/docs/current/static/textsearch-tables.html#TEXTSEARCH-TABLES-INDEX: "CREATE INDEX pgweb_idx ON pgweb USING GIN (to_tsvector('english', title || ' ' || body));"
I cannot imagine how to do it in django Here is my table: from django.contrib.postgres.indexes import GinIndex from django.contrib.postgres.search import SearchQuery from django.contrib.postgres.search import SearchVector import django.contrib.postgres.search as pg_search class Request(models.Model): open_date = models.DateTimeField(verbose_name='Creation Date', blank=True) close_date = models.DateTimeField(verbose_name='Closing Date', blank=True, null=True, ) def in_work_time(self): return timezone.now() - self.open_date def set_open_time(self): self.open_date = timezone.now() subject = models.CharField(max_length=500, verbose_name='Request subject') author = models.CharField(max_length=500, verbose_name='Request author') content = models.TextField(verbose_name='Request content') engineer = models.ForeignKey(User, on_delete=models.PROTECT, blank=True, verbose_name='Engineer assigned') priority = models.IntegerField(default=10, verbose_name='Priority') def __str__(self): return self.subject And here are my thoughts how it could look like. (It doesn't work): en_sv = pg_search.SearchVectorField(SearchVector( 'subject', 'content', config='english'), null=True) ru_sv = pg_search.SearchVectorField(SearchVector( 'subject', 'content', config='russian'), null=True) class Meta: indexes = [ GinIndex(fields=['ru_sv'], fastupdate=False, name='gin_search_ru_idx'), GinIndex(fields=['en_sv'], fastupdate=False, name='gin_search_en_idx'), ] Any thoughts? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/03077eeb-93bb-4991-a24b-f00fcaff0835%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.