docstr: target: check the search results
  method: 1. check the query number
          2. check the limit(topK) and ids
          3. check the distance
  expected: check the search is ok
docstr_tok: ["target",":","check","the","search","results","method",":","1.","check","the","query","number","2.","check","the","limit","(","topK",")","and","ids","3.","check","the","distance","expected",":","check","the","search","is","ok"]
code: def check_search_results(search_res, func_name, check_items):
      """
      target: check the search results
      method: 1. check the query number
              2. check the limit(topK) and ids
              3. check the distance
      expected: check the search is ok
      """
      log.info("search_results_check: checking the searching results")
      if func_name != "search":
          log.warning(
              "The function name is {} rather than {}".format(
                  func_name, "search"
              )
          )
      if len(check_items) == 0:
          raise Exception("No expect values found in the check task")
      if check_items.get("_async", None):
          if check_items["_async"]:
              search_res.done()
              search_res = search_res.result()
      if check_items.get("output_fields", None):
          assert set(search_res[0][0].entity.fields) == set(
              check_items["output_fields"]
          )
          log.info(
              "search_results_check: Output fields of query searched is correct"
          )
          if check_items.get("original_entities", None):
              original_entities = check_items["original_entities"][0]
              pc.output_field_value_check(search_res, original_entities)
      if len(search_res) != check_items["nq"]:
          log.error(
              "search_results_check: Numbers of query searched (%d) "
              "is not equal with expected (%d)"
              % (len(search_res), check_items["nq"])
          )
          assert len(search_res) == check_items["nq"]
      else:
          log.info(
              "search_results_check: Numbers of query searched is correct"
          )
      enable_high_level_api = check_items.get(
          "enable_high_level_api", False
      )
      log.debug(search_res)
      for hits in search_res:
          searched_original_vectors = []
          ids = []
          if enable_high_level_api:
              for hit in hits:
                  ids.append(hit["id"])
          else:
              ids = list(hits.ids)
          if (len(hits) != check_items["limit"]) or (
              len(ids) != check_items["limit"]
          ):
              log.error(
                  "search_results_check: limit(topK) searched (%d) "
                  "is not equal with expected (%d)"
                  % (len(hits), check_items["limit"])
              )
              assert len(hits) == check_items["limit"]
              assert len(ids) == check_items["limit"]
          else:
              if check_items.get("ids", None) is not None:
                  ids_match = pc.list_contain_check(
                      ids, list(check_items["ids"])
                  )
                  if not ids_match:
                      log.error(
                          "search_results_check: ids searched not match"
                      )
                      assert ids_match
              elif check_items.get("metric", None) is not None:
                  if check_items.get("vector_nq") is None:
                      raise Exception(
                          "vector for searched (nq) is needed for distance check"
                      )
                  if check_items.get("original_vectors") is None:
                      raise Exception(
                          "inserted vectors are needed for distance check"
                      )
                  for id in hits.ids:
                      searched_original_vectors.append(
                          check_items["original_vectors"][id]
                      )
                  cf.compare_distance_vector_and_vector_list(
                      check_items["vector_nq"][i],
                      searched_original_vectors,
                      check_items["metric"],
                      hits.distances,
                  )
                  log.info(
                      "search_results_check: Checked the distances for one nq: OK"
                  )
              else:
                  pass  # just check nq and topk, not specific ids need check
      log.info(
          "search_results_check: limit (topK) and "
          "ids searched for %d queries are correct" % len(search_res)
      )
  
      return True
  
imports: from pymilvus.client.types import CompactionPlans
  from pymilvus import Role
  from utils.util_log import test_log
  from common import common_type
  from common import common_func
  from common.common_type import CheckTasks, Connect_Object_Name
  from pymilvus import Collection, Partition, ResourceGroupInfo
  from utils.api_request import Error
  import check.param_check
label_desc: Use image node_id 10 for calling the ResponseChecker obj's underlying member method code with example usage: obj.check_search_results(search_res, func_name, check_items) and returns: True