class_docstr: MongoDB driver for image-match
  
      
code: def search_single_record(
      self,
      rec,
      n_parallel_words=1,
      word_limit=None,
      process_timeout=None,
      maximum_matches=1000,
      filter=None,
  ):
      if n_parallel_words is None:
          n_parallel_words = cpu_count()
  
      if word_limit is None:
          word_limit = self.N
  
      initial_q = managerQueue.Queue()
  
      [
          initial_q.put({field_name: rec[field_name]})
          for field_name in self.index_names[:word_limit]
      ]
  
      # enqueue a sentinel value so we know we have reached the end of the queue
      initial_q.put("STOP")
      queue_empty = False
  
      # create an empty queue for results
      results_q = Queue()
  
      # create a set of unique results, using MongoDB _id field
      unique_results = set()
  
      l = list()
  
      while True:
          # build children processes, taking cursors from in_process queue first, then initial queue
          p = list()
          while len(p) < n_parallel_words:
              word_pair = initial_q.get()
              if word_pair == "STOP":
                  # if we reach the sentinel value, set the flag and stop queuing processes
                  queue_empty = True
                  break
              if not initial_q.empty():
                  p.append(
                      Process(
                          target=get_next_match,
                          args=(
                              results_q,
                              word_pair,
                              self.collection,
                              np.array(rec["signature"]),
                              self.distance_cutoff,
                              maximum_matches,
                          ),
                      )
                  )
  
          if len(p) > 0:
              for process in p:
                  process.start()
          else:
              break
  
          # collect results, taking care not to return the same result twice
  
          num_processes = len(p)
  
          while num_processes:
              results = results_q.get()
              if results == "STOP":
                  num_processes -= 1
              else:
                  for key in results.keys():
                      if key not in unique_results:
                          unique_results.add(key)
                          l.append(results[key])
  
          for process in p:
              process.join()
  
          # yield a set of results
          if queue_empty:
              break
  
      return l
  
file_path: image-match/image_match/mongodb_driver.py
imports: from signature_database_base import SignatureDatabaseBase
  from signature_database_base import normalized_distance
  from multiprocessing import cpu_count, Process, Queue
  from multiprocessing.managers import Queue
  import numpy
label_desc: Use image node_id 2 for calling the SignatureMongo obj's underlying member method code with example usage: obj.search_single_record(rec, n_parallel_words, word_limit, process_timeout, maximum_matches, filter) and returns: l