code: def search_preassigned(index_ivf, xq, k, list_nos, coarse_dis=None):
      """
      Perform a search in the IVF index, with predefined lists to search into.
      Supports indexes with pretransforms (as opposed to the
      IndexIVF.search_preassigned, that cannot be applied with pretransform).
      """
      n, d = xq.shape
      if isinstance(index_ivf, faiss.IndexBinaryIVF):
          d *= 8
          dis_type = "int32"
      else:
          dis_type = "float32"
  
      assert d == index_ivf.d
      assert list_nos.shape == (n, index_ivf.nprobe)
  
      # the coarse distances are used in IVFPQ with L2 distance and
      # by_residual=True otherwise we provide dummy coarse_dis
      if coarse_dis is None:
          coarse_dis = np.zeros((n, index_ivf.nprobe), dtype=dis_type)
      else:
          assert coarse_dis.shape == (n, index_ivf.nprobe)
  
      return index_ivf.search_preassigned(xq, k, list_nos, coarse_dis)
  
file_path: faiss/contrib/ivf_tools.py
imports: import numpy
  import faiss
  from faiss.contrib.inspect_tools import get_invlist_sizes
label_desc: Use image node_id 2 for calling a global function with example usage: search_preassigned(index_ivf, xq, k, list_nos, coarse_dis) and returns: index_ivf