0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-29 17:36:49 +01:00

Adds back default primary key ordering.

This commit is contained in:
Bertrand Bordage 2017-10-18 22:06:57 +01:00
parent d19934512d
commit 42c38a6af0

View File

@ -212,12 +212,12 @@ class PostgresSearchQuery(BaseSearchQuery):
queryset = queryset.annotate(
_rank_=SearchRank(F('_search_'), search_query,
weights=WEIGHTS_VALUES)
).order_by('-_rank_')
).order_by('-_rank_', '-pk')
elif not queryset.query.order_by:
# Adds a default ordering to avoid issue #3729.
queryset = queryset.order_by('-pk')
return queryset[start:stop]
def search_count(self, config):
return self.search(config, None, None).count()
class PostgresSearchResults(BaseSearchResults):
def get_config(self):
@ -230,7 +230,7 @@ class PostgresSearchResults(BaseSearchResults):
self.start, self.stop))
def _do_count(self):
return self.query.search_count(self.get_config())
return self.query.search(self.get_config(), None, None).count()
class PostgresSearchRebuilder: