About Full-text Search with Postgres

You can do a full-text search with PostgreSQL using a QuerySet like this:

from django.contrib.postgres.search import SearchVector
from django.contrib.postgres.search import SearchQuery
keywords = "Django Tricks"

queryset = Post.objects.annotate(
    search=SearchVector("title", "description", "author_bio")
).filter(
    search=SearchQuery(keywords)
)

Tips and Tricks Programming Databases Django 4.2 Django 3.2 Django 2.2 PostgreSQL