code: def linear_build_and_search(
      doc,
      query,
      topk,
      column_number=None,
      row_number=None,
      dimension=None,
      measure_name=None,
      threads=4,
  ):
      if measure_name is None:
          measure_name = "SquaredEuclidean"
      if dimension is None:
          dimension = doc.shape[1]
  
      index = build_index(
          tensor=doc,
          dimension=dimension,
          column_number=column_number,
          distance_metric=measure_name,
          index_builder="LinearBuilder",
      )
  
      pk_l, distance_l = search_index(
          tensor=query,
          threads=threads,
          row_number=row_number,
          distance_metric=measure_name,
          dimension=dimension,
          topk=topk,
          index=index,
      )
  
      return pk_l, distance_l
  
file_path: mars/mars/learn/proxima/simple_index/knn.py
imports: import random
  import pandas
  from ....None import dataframe
  from ....None import tensor
  from .None import build_index, search_index
label_desc: Use image node_id 2 for calling a global function with example usage: linear_build_and_search(doc, query, topk, column_number, row_number, dimension, measure_name, threads) and returns: pk_l,  distance_l