Used homogeneous weights list in SearchRank tests.

A homogenous array is required on PostgreSQL.
This commit is contained in:
Florian Apolloner 2022-12-06 12:45:47 +01:00 committed by Mariusz Felisiak
parent c14e5c64c9
commit d8c8761901
1 changed files with 2 additions and 1 deletions

View File

@ -514,10 +514,11 @@ class TestRankingAndWeights(GrailTestData, PostgreSQLTestCase):
vector = SearchVector("dialogue", weight="D") + SearchVector( vector = SearchVector("dialogue", weight="D") + SearchVector(
"character__name", weight="A" "character__name", weight="A"
) )
weights = [1.0, 0.0, 0.0, 0.5]
searched = ( searched = (
Line.objects.filter(scene=self.witch_scene) Line.objects.filter(scene=self.witch_scene)
.annotate( .annotate(
rank=SearchRank(vector, SearchQuery("witch"), weights=[1, 0, 0, 0.5]), rank=SearchRank(vector, SearchQuery("witch"), weights=weights),
) )
.order_by("-rank")[:2] .order_by("-rank")[:2]
) )