[Django]-How can I use SearchRank in a Django model field?

7👍

I found it. I needed to use a F expression:

Post.objects.annotate(
   rank=SearchRank(F('vector_column'),
   SearchQuery(query, config='english'))
).order_by('-rank'), 15

Leave a comment