mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +01:00
Fixes postgres_search when using annotate_score
& order_by_relevance=False
.
This commit is contained in:
parent
3c862676dd
commit
d411fee905
@ -282,7 +282,7 @@ class PostgresSearchQueryCompiler(BaseSearchQueryCompiler):
|
||||
elif not queryset.query.order_by:
|
||||
# Adds a default ordering to avoid issue #3729.
|
||||
queryset = queryset.order_by('-pk')
|
||||
rank_expression = F('pk').desc()
|
||||
rank_expression = F('pk')
|
||||
if score_field is not None:
|
||||
queryset = queryset.annotate(**{score_field: rank_expression})
|
||||
return queryset[start:stop]
|
||||
|
Loading…
Reference in New Issue
Block a user