code: def proxima_build_and_query(
      doc,
      query,
      topk,
      measure_name=None,
      dimension=None,
      index_builder=None,
      builder_params=None,
      index_converter=None,
      index_converter_params=None,
      index_searcher=None,
      searcher_params=None,
      index_reformer=None,
      index_reformer_params=None,
  ):
      if measure_name is None:
          measure_name = "SquaredEuclidean"
      if dimension is None:
          dimension = doc.shape[1]
      if index_builder is None:
          index_builder = "SsgBuilder"
      if builder_params is None:
          builder_params = {}
      if index_converter_params is None:
          index_converter_params = {}
      if index_searcher is None:
          index_searcher = ""
      if searcher_params is None:
          searcher_params = {}
      if index_reformer is None:
          index_reformer = ""
      if index_reformer_params is None:
          index_reformer_params = {}
  
      map_dtype = {
          np.dtype(np.float32): proxima.IndexMeta.FT_FP32,
          np.dtype(np.int16): proxima.IndexMeta.FT_INT16,
      }
      # holder
      holder = proxima.IndexHolder(
          type=map_dtype[doc.dtypes[0]], dimension=dimension
      )
      holder.mount(np.array(doc))  # add batch data, pk starts from 0
  
      # converter
      meta = proxima.IndexMeta(
          map_dtype[doc.dtypes[0]],
          dimension=dimension,
          measure_name=measure_name,
      )
      if index_converter is not None:
          if index_converter == "MipsConverter":
              measure_name = ""
          converter = proxima.IndexConverter(
              name=index_converter,
              meta=meta,
              params=index_converter_params,
          )
          converter.train_and_transform(holder)
          holder = converter.result()
          meta = converter.meta()
  
      # builder && dumper
      builder = proxima.IndexBuilder(
          name=index_builder, meta=meta, params=builder_params
      )
      builder = builder.train_and_build(holder)
      dumper = proxima.IndexDumper(
          name="MemoryDumper", path="test.index"
      )
      builder.dump(dumper)
      dumper.close()
  
      # indexflow for search
      flow = proxima.IndexFlow(
          container_name="MemoryContainer",
          container_params={},
          searcher_name=index_searcher,
          searcher_params=searcher_params,
          measure_name=measure_name,
          measure_params={},
          reformer_name=index_reformer,
          reformer_params=index_reformer_params,
      )
      flow.load("test.index")
      keys, scores = proxima.IndexUtility.ann_search(
          searcher=flow, query=query, topk=topk, threads=1
      )
      return np.asarray(keys), np.asarray(scores)
  
file_path: mars/mars/learn/proxima/simple_index/tests/test_simple_index.py
imports: import os
  import tempfile
  import numpy
  import pandas
  import pytest
  from .....None import dataframe
  from .....None import tensor
  from ...core import proxima
  from ..None import build_index, search_index, recall
label_desc: Use image node_id 1 for calling a global function with example usage: proxima_build_and_query(doc, query, topk, measure_name, dimension, index_builder, builder_params, index_converter, index_converter_params, index_searcher, searcher_params, index_reformer, index_reformer_params) and returns: np,  np