docstr: Query by vector using index and append distance to results
  
  it is assumed len(vect) == len(df) == len(search_index)
  args:
      vect: query vector
      df: dataframe to query
      search_index: annoy index
      top_n: number of results to return
  returns:
      sorted dataframe with top_n results and distance
docstr_tok: ["Query","by","vector","using","index","and","append","distance","to","results","it","is","assumed","len","(","vect",")","==","len","(","df",")","==","len","(","search_index",")","args",":","vect",":","query","vector","df",":","dataframe","to","query","search_index",":","annoy","index","top_n",":","number","of","results","to","return","returns",":","sorted","dataframe","with","top_n","results","and","distance"]
code: def search_df(self, q, df, k):
      """Query by vector using index and append distance to results
  
      it is assumed len(vect) == len(df) == len(search_index)
      args:
          vect: query vector
          df: dataframe to query
          search_index: annoy index
          top_n: number of results to return
      returns:
          sorted dataframe with top_n results and distance
      """
  
      indices, distances = self.search(q.values[0], k=k)
  
      results = df.iloc[indices]
      results.loc[:, DISTANCE] = distances
      results = results.sort_values(by=[DISTANCE])
  
      return results
  
file_path: pygraphistry/graphistry/ai_utils.py
imports: import pandas
  import numpy
  import graphistry
  from .constants import DISTANCE, WEIGHT, BATCH
  from logging import getLogger
label_desc: Use image node_id 3 for calling the FaissVectorSearch obj's underlying member method code with example usage: obj.search_df(q, df, k) and returns: results