Skip to content

Commit 56ea498

Browse files
committed
updating score assertions to use close_to instead of match
1 parent 9d24fcc commit 56ea498

File tree

2 files changed

+22
-26
lines changed

2 files changed

+22
-26
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -531,9 +531,6 @@ tests:
531531
- class: org.elasticsearch.packaging.test.DockerTests
532532
method: test040JavaUsesTheOsProvidedKeystore
533533
issue: https://github.com/elastic/elasticsearch/issues/128230
534-
- class: org.elasticsearch.xpack.rank.rrf.LinearRankClientYamlTestSuiteIT
535-
method: test {yaml=linear/10_linear_retriever/should normalize initial scores with l2_norm}
536-
issue: https://github.com/elastic/elasticsearch/issues/128774
537534
- class: org.elasticsearch.index.codec.vectors.es818.ES818HnswBinaryQuantizedVectorsFormatTests
538535
method: testSimpleOffHeapSizeFSDir
539536
issue: https://github.com/elastic/elasticsearch/issues/128799

x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/linear/10_linear_retriever.yml

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ setup:
8181

8282
- match: { hits.total.value: 2 }
8383
- match: { hits.hits.0._id: "1" }
84-
- match: { hits.hits.0._score: 5.0 }
84+
- close_to: { hits.hits.0._score: { value: 5.0, error: 0.001} }
8585
- match: { hits.hits.1._id: "4" }
86-
- match: { hits.hits.1._score: 2.0 }
86+
- close_to: { hits.hits.1._score: { value: 2.0, error: 0.001} }
8787

8888
---
8989
"basic linear weighted combination - interleaved results":
@@ -174,13 +174,13 @@ setup:
174174

175175
- match: { hits.total.value: 4 }
176176
- match: { hits.hits.0._id: "1" }
177-
- match: { hits.hits.0._score: 20.0 }
177+
- close_to: { hits.hits.0._score: { value: 20.0, error: 0.001} }
178178
- match: { hits.hits.1._id: "3" }
179-
- match: { hits.hits.1._score: 15.0 }
179+
- close_to: { hits.hits.1._score: { value: 15.0, error: 0.001} }
180180
- match: { hits.hits.2._id: "4" }
181-
- match: { hits.hits.2._score: 12.0 }
181+
- close_to: { hits.hits.2._score: { value: 12.0, error: 0.001} }
182182
- match: { hits.hits.3._id: "2" }
183-
- match: { hits.hits.3._score: 10.0 }
183+
- close_to: { hits.hits.3._score: { value: 10.0, error: 0.001} }
184184

185185
---
186186
"should normalize initial scores":
@@ -256,12 +256,11 @@ setup:
256256

257257
- match: { hits.total.value: 4 }
258258
- match: { hits.hits.0._id: "1" }
259-
- match: {hits.hits.0._score: 10.0}
259+
- close_to: { hits.hits.0._score: { value: 10.0, error: 0.001} }
260260
- match: { hits.hits.1._id: "2" }
261-
- match: {hits.hits.1._score: 8.0}
261+
- close_to: { hits.hits.1._score: { value: 8.0, error: 0.001} }
262262
- match: { hits.hits.2._id: "4" }
263-
- match: {hits.hits.2._score: 2.0}
264-
- match: { hits.hits.2._score: 2.0 }
263+
- close_to: { hits.hits.2._score: { value: 2.0, error: 0.001} }
265264
- match: { hits.hits.3._id: "3" }
266265
- close_to: { hits.hits.3._score: { value: 0.0, error: 0.001 } }
267266

@@ -310,13 +309,13 @@ setup:
310309

311310
- match: { hits.total.value: 4 }
312311
- match: { hits.hits.0._id: "2" }
313-
- match: { hits.hits.0._score: 8.0 }
312+
- close_to: { hits.hits.0._score: { value: 8.0, error: 0.001} }
314313
- match: { hits.hits.1._id: "1" }
315-
- match: { hits.hits.1._score: 6.0 }
314+
- close_to: { hits.hits.1._score: { value: 6.0, error: 0.001} }
316315
- match: { hits.hits.2._id: "4" }
317316
- close_to: { hits.hits.2._score: { value: 1.6, error: 0.001 } }
318317
- match: { hits.hits.3._id: "3" }
319-
- match: { hits.hits.3._score: 1.2 }
318+
- close_to: { hits.hits.3._score: { value: 1.2, error: 0.001} }
320319

321320
---
322321
"should handle all zero scores in normalization":
@@ -514,7 +513,7 @@ setup:
514513
- match: { hits.total.value: 4 }
515514
- length: { hits.hits: 1 }
516515
- match: { hits.hits.0._id: "4" }
517-
- match: { hits.hits.0._score: 2.0 }
516+
- close_to: { hits.hits.0._score: { value: 2.0, error: 0.001} }
518517

519518
- do:
520519
search:
@@ -703,9 +702,9 @@ setup:
703702

704703
- match: { hits.total.value: 4 }
705704
- match: { hits.hits.0._id: "4" }
706-
- match: { hits.hits.0._score: 2.0 }
705+
- close_to: { hits.hits.0._score: { value: 2.0, error: 0.001} }
707706
- match: { hits.hits.1._id: "1" }
708-
- match: { hits.hits.1._score: 1.0 }
707+
- close_to: { hits.hits.1._score: { value: 1.0, error: 0.001} }
709708

710709
---
711710
"explain should provide info on weights and inner retrievers":
@@ -908,11 +907,11 @@ setup:
908907

909908
- match: { hits.total.value: 3 }
910909
- match: { hits.hits.0._id: "2" }
911-
- match: { hits.hits.0._score: 40.0 }
910+
- close_to: { hits.hits.0._score: { value: 40.0, error: 0.001} }
912911
- match: { hits.hits.1._id: "1" }
913-
- match: { hits.hits.1._score: 5.0 }
912+
- close_to: { hits.hits.1._score: { value: 5.0, error: 0.001} }
914913
- match: { hits.hits.2._id: "4" }
915-
- match: { hits.hits.2._score: 2.0 }
914+
- close_to: { hits.hits.2._score: { value: 2.0, error: 0.001} }
916915

917916
---
918917
"linear retriever with filters":
@@ -962,7 +961,7 @@ setup:
962961
- match: { hits.total.value: 1 }
963962
- length: {hits.hits: 1}
964963
- match: { hits.hits.0._id: "4" }
965-
- match: { hits.hits.0._score: 2.0 }
964+
- close_to: { hits.hits.0._score: { value: 2.0, error: 0.001} }
966965

967966
---
968967
"linear retriever with filters on nested retrievers":
@@ -1013,7 +1012,7 @@ setup:
10131012
- match: { hits.total.value: 1 }
10141013
- length: {hits.hits: 1}
10151014
- match: { hits.hits.0._id: "4" }
1016-
- match: { hits.hits.0._score: 2.0 }
1015+
- close_to: { hits.hits.0._score: { value: 2.0, error: 0.001} }
10171016

10181017

10191018
---
@@ -1150,7 +1149,7 @@ setup:
11501149
- match: { hits.hits.0._id: "2" }
11511150
- close_to: { hits.hits.0._score: { value: 1.5, error: 0.001 } }
11521151
- match: { hits.hits.1._id: "1" }
1153-
- match: { hits.hits.1._score: 1 }
1152+
- close_to: { hits.hits.1._score: { value: 1, error: 0.001} }
11541153

11551154
---
11561155
"should throw when rank_window_size is negative":
@@ -1222,4 +1221,4 @@ setup:
12221221

12231222
- match: { hits.total.value: 1 }
12241223
- match: { hits.hits.0._id: "1" }
1225-
- match: { hits.hits.0._score: 1.0 }
1224+
- close_to: { hits.hits.0._score: { value: 1.0, error: 0.001} }

0 commit comments

Comments
 (0)