Document Payloads

    Since the scoring functions already have access to the DocumentMetaData, which contains document flags and score, We can add custom payloads that can be evaluated in run-time.

    Payloads are NOT indexed and are not treated by the engine in any way. They are simply there for the purpose of evaluating them in query time, and optionally retrieving them. They can be JSON objects, strings, or preferably, if you are interested in fast evaluation, some sort of binary encoded data which is fast to decode.

    When imlplementing a scoring function, the signature of the function exposed is:

    If no payload was set to the document, it is simply NULL. If it is not, you can go ahead and decode it. It is recommended to encode some metadata about the payload inside it, like a leading version number, etc.

    When searching, it is possible to request the document payloads from the engine.

    If is set, the payloads follow the document id in the returned result. If is set as well, the payloads follow the scores. e.g.: