MCPcopy Create free account
hub / github.com/couchbase/couchbase-python-client / load_docs

Function load_docs

examples/acouchbase/vector_search_async.py:99–110  ·  view source on GitHub ↗
(root: str, collection: AsyncCollection)

Source from the content-addressed store, hash-verified

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

Callers 1

setupFunction · 0.70

Calls 3

read_docsFunction · 0.70
upsertMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected