@@ -379,3 +379,111 @@ setup:
379379 - match : { hits.total.value: 1 }
380380 - length : { hits.hits: 1 }
381381 - match : { hits.hits.0._id: "doc_1" }
382+
383+ ---
384+ " Text similarity reranker respects min_score " :
385+
386+ - requires :
387+ cluster_features : " test_reranking_service.parse_text_as_score"
388+ reason : test_reranking_service can now parse provided input as score to provide deterministic ranks
389+
390+ - do :
391+ index :
392+ index : test-index
393+ id : doc_2
394+ body :
395+ text : " The phases of the Moon come from the position of the Moon relative to the Earth and Sun."
396+ topic : [ "science" ]
397+ subtopic : [ "astronomy" ]
398+ inference_text_field : " 10"
399+ refresh : true
400+
401+ - do :
402+ search :
403+ index : test-index
404+ body :
405+ track_total_hits : true
406+ fields : [ "text", "topic" ]
407+ retriever :
408+ text_similarity_reranker :
409+ retriever :
410+ standard :
411+ query :
412+ bool :
413+ should :
414+ - constant_score :
415+ filter :
416+ term : { subtopic: "technology" }
417+ boost : 10
418+ - constant_score :
419+ filter :
420+ term : { subtopic: "astronomy" }
421+ boost : 1
422+ rank_window_size : 10
423+ inference_id : my-rerank-model
424+ inference_text : " How often does the moon hide the sun?"
425+ field : inference_text_field
426+ min_score : 10
427+ size : 10
428+
429+ - match : { hits.total.value: 1 }
430+ - length : { hits.hits: 1 }
431+ - match : { hits.hits.0._id: "doc_2" }
432+
433+ ---
434+ " Text similarity reranker with min_score zero includes all docs " :
435+
436+ - requires :
437+ cluster_features : " test_reranking_service.parse_text_as_score"
438+ reason : test_reranking_service can now parse provided input as score to provide deterministic ranks
439+
440+ - do :
441+ search :
442+ index : test-index
443+ body :
444+ track_total_hits : true
445+ fields : [ "text", "topic" ]
446+ retriever :
447+ text_similarity_reranker :
448+ retriever :
449+ standard :
450+ query :
451+ match_all : {}
452+ rank_window_size : 10
453+ inference_id : my-rerank-model
454+ inference_text : " How often does the moon hide the sun?"
455+ field : inference_text_field
456+ min_score : 0
457+ size : 10
458+
459+ - match : { hits.total.value: 3 }
460+ - length : { hits.hits: 3 }
461+
462+ ---
463+ " Text similarity reranker with high min_score excludes all docs " :
464+
465+ - requires :
466+ cluster_features : " test_reranking_service.parse_text_as_score"
467+ reason : test_reranking_service can now parse provided input as score to provide deterministic ranks
468+
469+ - do :
470+ search :
471+ index : test-index
472+ body :
473+ track_total_hits : true
474+ fields : [ "text", "topic" ]
475+ retriever :
476+ text_similarity_reranker :
477+ retriever :
478+ standard :
479+ query :
480+ match_all : {}
481+ rank_window_size : 10
482+ inference_id : my-rerank-model
483+ inference_text : " How often does the moon hide the sun?"
484+ field : inference_text_field
485+ min_score : 1000
486+ size : 10
487+
488+ - match : { hits.total.value: 0 }
489+ - length : { hits.hits: 0 }
0 commit comments