class_docstr: run insert and search
class_docstr_tok: ["run","insert","and","search"]
code: def prepare(self, **case_param):
      collection_name = case_param["collection_name"]
      dimension = case_param["dimension"]
      vector_type = case_param["vector_type"]
      other_fields = case_param["other_fields"]
      index_field_name = case_param["index_field_name"]
      build_index = case_param["build_index"]
  
      self.milvus.set_collection(collection_name)
      if self.milvus.exists_collection():
          logger.debug("Start drop collection")
          self.milvus.drop()
          time.sleep(utils.DELETE_INTERVAL_TIME)
      self.milvus.create_collection(
          dimension, data_type=vector_type, other_fields=other_fields
      )
      # TODO: update fields in collection_info
      # fields = self.get_fields(self.milvus, collection_name)
      # collection_info = {
      #     "dimension": dimension,
      #     "metric_type": metric_type,
      #     "dataset_name": collection_name,
      #     "fields": fields
      # }
      if build_index is True:
          if case_param["index_type"]:
              self.milvus.create_index(
                  index_field_name,
                  case_param["index_type"],
                  case_param["metric_type"],
                  index_param=case_param["index_param"],
              )
              logger.debug(self.milvus.describe_index(index_field_name))
          else:
              build_index = False
              logger.warning("Please specify the index_type")
      insert_result = self.insert(
          self.milvus,
          collection_name,
          case_param["data_type"],
          dimension,
          case_param["collection_size"],
          case_param["ni_per"],
      )
      self.insert_result = insert_result
      build_time = 0.0
      start_time = time.time()
      self.milvus.flush()
      flush_time = round(time.time() - start_time, 2)
      logger.debug(self.milvus.count())
      if build_index is True:
          logger.debug("Start build index for last file")
          start_time = time.time()
          self.milvus.create_index(
              index_field_name,
              case_param["index_type"],
              case_param["metric_type"],
              index_param=case_param["index_param"],
          )
          build_time = round(time.time() - start_time, 2)
      # build_time includes flush and index time
      logger.debug({"flush_time": flush_time, "build_time": build_time})
      self.build_time = build_time
      logger.info(self.milvus.count())
      logger.info("Start load collection")
      load_start_time = time.time()
      self.milvus.load_collection(timeout=1200)
      logger.debug(
          {"load_time": round(time.time() - load_start_time, 2)}
      )
  
file_path: milvus/tests/benchmark/milvus_benchmark/runners/search.py
imports: import time
  import copy
  import json
  import logging
  from milvus_benchmark import parser
  from milvus_benchmark.runners import utils
  from milvus_benchmark.runners.base import BaseRunner
label_desc: Use image node_id 3 for calling the InsertSearchRunner obj's underlying member method code with example usage: obj.prepare() without return types