code: def add_to_index_and_search(index, query, reference, k):
      if reference is not None:
          index.add(reference.float().cpu())
      return index.search(query.float().cpu(), k)
  
imports: import numpy
  import torch
  from ..distances import BatchedDistance, CosineSimilarity
  from .None import common_functions
label_desc: Use image node_id 1 for calling a global function with example usage: add_to_index_and_search(index, query, reference, k) and returns: index