Skip to content

Commit 48ae44f

Browse files
committed
Score 0 test case added to check for corner cases
1 parent 7756928 commit 48ae44f

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,40 @@ setup:
318318
- match: { hits.hits.3._id: "3" }
319319
- match: { hits.hits.3._score: 1.2 }
320320

321+
---
322+
"should handle all zero scores in normalization":
323+
- do:
324+
search:
325+
index: test
326+
body:
327+
retriever:
328+
linear:
329+
retrievers: [
330+
{
331+
retriever: {
332+
standard: {
333+
query: {
334+
bool: {
335+
should: [
336+
{ constant_score: { filter: { term: { keyword: { value: "one" } } }, boost: 0.0 } },
337+
{ constant_score: { filter: { term: { keyword: { value: "two" } } }, boost: 0.0 } },
338+
{ constant_score: { filter: { term: { keyword: { value: "three" } } }, boost: 0.0 } },
339+
{ constant_score: { filter: { term: { keyword: { value: "four" } } }, boost: 0.0 } }
340+
]
341+
}
342+
}
343+
}
344+
},
345+
weight: 1.0,
346+
normalizer: "l2_norm"
347+
}
348+
]
349+
- match: { hits.total.value: 4 }
350+
- close_to: { hits.hits.0._score: { value: 0.0, error: 0.0001 } }
351+
- close_to: { hits.hits.1._score: { value: 0.0, error: 0.0001 } }
352+
- close_to: { hits.hits.2._score: { value: 0.0, error: 0.0001 } }
353+
- close_to: { hits.hits.3._score: { value: 0.0, error: 0.0001 } }
354+
321355
---
322356
"should throw on unknown normalizer":
323357
- do:

0 commit comments

Comments
 (0)