Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
AlisoSouza committed Jul 30, 2024
1 parent c8266c8 commit bb2973c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/indexer/content_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ def __init__(self, storage: IStorage):
self.storage = storage

def index_documents(self, docs: List[Document]):
BATCH_SIZE: int = 500
docs_size: int = len(docs)

file_uuid = docs[0].metadata["file_uuid"]
content_base_uuid = docs[0].metadata["content_base_uuid"]

Expand All @@ -24,7 +27,11 @@ def index_documents(self, docs: List[Document]):
ids = [item["_id"] for item in results]
self.storage.delete(ids=ids)

return self.storage.save(docs)
for i in range(0, docs_size, BATCH_SIZE):
print(i, BATCH_SIZE+i)
self.storage.save(docs[i:BATCH_SIZE+i])

return

def index(self, texts: List, metadatas: dict):
results = self._search_docs_by_content_base_uuid(
Expand Down

0 comments on commit bb2973c

Please sign in to comment.