set_function

The function set_function(score_function_name, collection_name, function_name) sets a score function as part of Lexical Search or Hybrid Search. This step is mandatory.

Input -

  • score_function_name – Specifies one of the following

    • The name and path of the file containing the logic to be used in the search query, which is described in step #1 above. This loads the contents of this file to a local object.

    • The name of the function containing the logic to be used in the search

  • collection_name – Specifies the name of the Collection that contains the data to be searched.

  • function_name – Assigns the score function a local object name to be used later when running the search query.

Example 1-

hyperspace_client.set_function(score_function_name,
                                collection_name=collection_name,
                                function_name='score_function')

The set_function module is optimized for performance. When used repeatedly with recurring value of function_name, the set_function module compares the new score function with the previously set one and will only be activated if the two are not identical.

Last updated