When I search useing SearchRank, if it does not find anything, it returns everything

When I search using SearchRank, if it does not find anything, it returns everything. How can I fix this problem?

views :

        self.search = form.cleaned_data['search']
        vector = SearchVector('title', weight='A') + SearchVector('description', weight='C') + SearchVector('category', weight='B')
        query = SearchQuery(self.search)
        self.results = post.annotate(rank=SearchRank(vector, query)).order_by('-rank')
Back to Top