code: def search_test(host="127.0.0.1", index_type="HNSW"):
      logger.info(f"recall test for index type {index_type}")
      file_path = f"{str(Path(__file__).absolute().parent.parent.parent)}/assets/ann_hdf5/sift-128-euclidean.hdf5"
      train, test, neighbors = read_benchmark_hdf5(file_path)
      connections.connect(host=host, port="19530")
      collection = Collection(name=f"sift_128_euclidean_{index_type}")
      nq = 10000
      topK = 100
      search_params = gen_search_param(index_type)
      for i in range(3):
          t0 = time.time()
          logger.info(f"\nSearch...")
          # define output_fields of search result
          res = collection.search(
              test[:nq],
              "float_vector",
              search_params,
              topK,
              output_fields=["int64"],
              timeout=TIMEOUT,
          )
          t1 = time.time()
          logger.info(f"search cost  {t1 - t0:.4f} seconds")
          result_ids = []
          for hits in res:
              result_id = []
              for hit in hits:
                  result_id.append(hit.entity.get("int64"))
              result_ids.append(result_id)
  
          # calculate recall
          true_ids = neighbors[:nq, :topK]
          sum_radio = 0.0
          for index, item in enumerate(result_ids):
              # tmp = set(item).intersection(set(flat_id_list[index]))
              assert len(item) == len(
                  true_ids[index]
              ), f"get {len(item)} but expect {len(true_ids[index])}"
              tmp = set(true_ids[index]).intersection(set(item))
              sum_radio = sum_radio + len(tmp) / len(item)
          recall = round(sum_radio / len(result_ids), 6)
          logger.info(f"recall={recall}")
          if index_type in ["IVF_PQ", "ANNOY"]:
              assert recall >= 0.6, f"recall={recall} < 0.6"
          else:
              assert (
                  0.95 <= recall < 1.0
              ), f"recall is {recall}, less than 0.95, greater than or equal to 1.0"
  
file_path: milvus/tests/python_client/deploy/scripts/second_recall_test.py
imports: import h5py
  import numpy
  import time
  import sys
  import threading
  from pathlib import Path
  from loguru import logger
  from pymilvus import connections, Collection
label_desc: Use image node_id 3 for calling a global function with example usage: search_test(host, index_type) without return types