MCPcopy Index your code
hub / github.com/couchbase/couchbase-python-client / load_docs

Function load_docs

examples/couchbase/vector_search.py:98–109  ·  view source on GitHub ↗
(root: str, collection: Collection)

Source from the content-addressed store, hash-verified

96
97
98def load_docs(root: str, collection: Collection) -> List[str]:
99 idx = 0
100 keys = []
101 for doc in read_docs():
102 key = f'{root}_{idx}'
103 # the search index expects a type field w/ vector as the value
104 doc['type'] = 'vector'
105 collection.upsert(key, doc)
106 keys.append(key)
107 idx += 1
108 print(f'loaded {len(keys)} docs.')
109 return keys
110
111
112def remove_docs(keys: List[str], collection: Collection) -> None:

Callers 1

setupFunction · 0.70

Calls 3

read_docsFunction · 0.70
upsertMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected