debug_info(str message, float var)allows to print message and variables from the score function. The output will be saved under the search result.

This function is a useful tool to assist in debug of the score function.


  • message(str) - the message to be saved in the search result.

  • var(float or int) - a variable to be stored as part of the message.


  • (str) - a message that includes the printed output.


def score_function(params, doc):
    if match(fieldname_doc = "ips", fieldname_params="ips"):
        a = 1.0
        score = a + 1
        debug_info("the first score is", score)
        if match(fieldname_doc = "ips", fieldname_params="ips"):
            score = 3.0 
            debug_info("the second score is", score)
        return score
    return 0

In the above example -

The search results will include two additional keys per candidate, stored under the "similarity" key, corresponding to the messages created using debug_info in the score function.

            "document_id": "doc_1",
            "the first score is": 2.0
            "the second score is": 3,

Last updated