def test_score_modifier_with_large_values(self):
        """Test behavior with very large score modifier values"""
        for index_name in [self.structured_index_name, self.unstructured_index_name]:
            with self.subTest(index_name=index_name):
                docs = [
                    {"_id": "1", "text_field": "test", "double_score_mods": 1e20},
                    {"_id": "2", "text_field": "test", "double_score_mods": 1e10},
                ]
                tensor_fields = ["text_field"] if "unstr" in index_name else None
                self.client.index(index_name).add_documents(documents=docs, tensor_fields=tensor_fields)

                res = self.client.index(index_name).search(
                    q="",
                    score_modifiers={
                        "multiply_score_by": [{"field_name": "double_score_mods", "weight": 1}]
                    }
                )

                # Expected score calculation:
                # Doc 1: base_score * 1e20
                # Doc 2: base_score * 1e10
                # The exact values might cause overflow, so we'll check the ratio
                score_ratio = res["hits"][0]["_score"] / res["hits"][1]["_score"]
                expected_ratio = 1e10  # (1e20 / 1e10)

                self.assertGreater(res["hits"][0]["_score"], res["hits"][1]["_score"])
                self.assertAlmostEqual(math.log10(score_ratio), math.log10(expected_ratio), places=1)
Test behavior with very large score modifier values
tests/api_tests/v1/tests/api_tests/test_dict_score_modifiers.py