Skip to content

Commit a16ddb5

Browse files
author
Simon Willison
committed
Order search results by relevance
1 parent 7f6b524 commit a16ddb5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

blog/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ def search_results(request, q):
411411
rank=rank_annotation,
412412
type=models.Value('quotation', output_field=models.CharField())
413413
).filter(search_document=query).values('pk', 'type', 'created', 'rank'),
414-
)
414+
).order_by('-rank')
415415

416416
paginator = Paginator(qs, 40)
417417
page_number = request.GET.get('page') or '1'

0 commit comments

Comments
 (0)