Skip to content

Commit

Permalink
more debug prints3
Browse files Browse the repository at this point in the history
  • Loading branch information
zMardone committed Jul 11, 2024
1 parent d981c7e commit 9c013a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/indexer/content_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@ def __init__(self, storage: IStorage):
def index_documents(self, docs: List[Document]):
file_uuid = docs[0].metadata["file_uuid"]
content_base_uuid = docs[0].metadata["content_base_uuid"]

print("start _search_docs_by_content_base_uuid")
results = self._search_docs_by_content_base_uuid(
content_base_uuid=content_base_uuid,
file_uuid=file_uuid,
)
print("end _search_docs_by_content_base_uuid")
ids = []
if len(results) > 0:
ids = [item["_id"] for item in results]
self.storage.delete(ids=ids)

print("start save")
return self.storage.save(docs)

def index(self, texts: List, metadatas: dict):
Expand Down
4 changes: 4 additions & 0 deletions app/store/elasticsearch_vector_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def __init__(self, vectorstore: VectorStore, score=1.55):
self.score = score

def save(self, doc: Document) -> list[str]:
print("Entrou no save do ElasticsearchVectorStoreIndex")
texts = [doc.page_content]
metadatas = [doc.metadata]
return self.vectorstore.add_texts(texts, metadatas)
Expand Down Expand Up @@ -59,7 +60,9 @@ def delete(self, ids: list[str] = []) -> bool:
class ContentBaseElasticsearchVectorStoreIndex(ElasticsearchVectorStoreIndex):

def save(self, docs: list[Document]) -> list[str]:
print("entrou no save do ContentBaseElasticsearchVectorStoreIndex")
index = os.environ.get("INDEX_CONTENTBASES_NAME", "content_bases")
print("STARTOU FROM_DOCUMENTS")
res = self.vectorstore.from_documents(
docs,
self.vectorstore.embeddings,
Expand All @@ -70,6 +73,7 @@ def save(self, docs: list[Document]) -> list[str]:
"max_chunk_bytes": 200000000
}
)
print("TERMINOU FROM_DOCUMENTS")
return res

def query_search(self, search_filter: dict) -> list[dict]:
Expand Down

0 comments on commit 9c013a8

Please sign in to comment.