mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-20 13:01:56 +00:00
Backport fix for converting SearchRank weight list, from 781263d4e1
This commit is contained in:
parent
857e397870
commit
f4db4fcea9
1 changed files with 4 additions and 1 deletions
|
|
@ -266,9 +266,12 @@ class PostgresSearchQuery(BaseSearchQuery):
|
|||
sql, index_params + model_params + limits)
|
||||
|
||||
def search_in_fields(self, queryset, search_query, start, stop):
|
||||
# Due to a Django bug, arrays are not automatically converted here.
|
||||
converted_weights = '{' + ','.join(map(str, WEIGHTS_VALUES)) + '}'
|
||||
|
||||
return (self.get_in_fields_queryset(queryset, search_query)
|
||||
.annotate(_rank_=SearchRank(F('_search_'), search_query,
|
||||
weights=WEIGHTS_VALUES))
|
||||
weights=converted_weights))
|
||||
.order_by('-_rank_'))[start:stop]
|
||||
|
||||
def search(self, config, start, stop):
|
||||
|
|
|
|||
Loading…
Reference in a new issue