bug: order is not applied to search results
dopry opened this issue · 1 comments
dopry commented
When using both searchQuery and order, the results are not ordered according to order.
dopry commented
So my PR didn't in fact fix this in all cases. I missed the paginated response and that order_by_relevance is true by default and will always take precedence over an existing order by in
if self.order_by_relevance:
queryset = queryset.order_by(rank_expression.desc(), "-pk")
elif not queryset.query.order_by:
# Adds a default ordering to avoid issue #3729.
queryset = queryset.order_by("-pk")
rank_expression = F("pk")
so relevance always takes precedence... not sure why my tests were passing. I'm gonna take another run at this tonight.