Function
load_docs
(root: str, collection: Collection)
Source from the content-addressed store, hash-verified
| 96 | |
| 97 | |
| 98 | def 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 | |
| 112 | def remove_docs(keys: List[str], collection: Collection) -> None: |
Tested by
no test coverage detected