class_docstr: combines a set of inverted lists into a hstack
  masks part of those lists
  adds these inverted lists to an empty index that contains
  the info on how to perform searches
class_docstr_tok: ["combines","a","set","of","inverted","lists","into","a","hstack","masks","part","of","those","lists","adds","these","inverted","lists","to","an","empty","index","that","contains","the","info","on","how","to","perform","searches"]
code: def __init__(
      self, invlist_fnames, empty_index_fname, masked_index_fname=None
  ):
      self.indexes = indexes = []
      ilv = faiss.InvertedListsPtrVector()
  
      for fname in invlist_fnames:
          if os.path.exists(fname):
              print("reading", fname, end="\r", flush=True)
              index = faiss.read_index(fname)
              indexes.append(index)
              il = faiss.extract_index_ivf(index).invlists
          else:
              raise AssertionError
          ilv.push_back(il)
      print()
  
      self.big_il = faiss.VStackInvertedLists(ilv.size(), ilv.data())
      if masked_index_fname:
          self.big_il_base = self.big_il
          print("loading", masked_index_fname)
          self.masked_index = faiss.read_index(
              masked_index_fname,
              faiss.IO_FLAG_MMAP | faiss.IO_FLAG_READ_ONLY,
          )
          self.big_il = faiss.MaskedInvertedLists(
              faiss.extract_index_ivf(self.masked_index).invlists,
              self.big_il_base,
          )
  
      print("loading empty index", empty_index_fname)
      self.index = faiss.read_index(empty_index_fname)
      ntotal = self.big_il.compute_ntotal()
  
      print("replace invlists")
      index_ivf = faiss.extract_index_ivf(self.index)
      index_ivf.replace_invlists(self.big_il, False)
      index_ivf.ntotal = self.index.ntotal = ntotal
      index_ivf.parallel_mode = (
          1  # seems reasonable to do this all the time
      )
  
      quantizer = faiss.downcast_index(index_ivf.quantizer)
      quantizer.hnsw.efSearch = 1024
  
file_path: faiss/benchs/distributed_ondisk/combined_index.py
imports: import os
  import faiss
  import numpy
label_desc: Use image node_id 1 to create a new CombinedIndex object  with example: obj = CombinedIndex(invlist_fnames, empty_index_fname, masked_index_fname)