You might want to search against multiple fields. In this case, you will need to define SearchVector. Let's build a vector that allows us to search against the title and body fields of the Post model:
from django.contrib.postgres.search import SearchVectorfrom blog.models import PostPost.objects.annotate( search=SearchVector('title', 'body'),).filter(search='django')
Using annotate and defining SearchVector with both fields, we provide a functionality to match the query against both the title and body of the posts.