MCPcopy Create free account
hub / github.com/BeastyZ/ConvSearch-R1 / add_batch_document

Method add_batch_document

index/dense/libs.py:60–69  ·  view source on GitHub ↗

add a batch of documents to the index

(self, row, col, data, n_docs=-1)

Source from the content-addressed store, hash-verified

58 self.index_doc_value = defaultdict(lambda: array.array("f"))
59
60 def add_batch_document(self, row, col, data, n_docs=-1):
61 """add a batch of documents to the index
62 """
63 if n_docs < 0:
64 self.n += len(set(row))
65 else:
66 self.n += n_docs
67 for doc_id, dim_id, value in zip(row, col, data):
68 self.index_doc_id[dim_id].append(doc_id)
69 self.index_doc_value[dim_id].append(value)
70
71 def __len__(self):
72 return len(self.index_doc_id)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected