fix add segment when dataset and document is empty (#3021)

Co-authored-by: jyong <jyong@dify.ai>
This commit is contained in:
Jyong
2024-03-29 13:06:00 +08:00
committed by GitHub
parent 2c43393bf1
commit a6cd0f0e73
4 changed files with 24 additions and 2 deletions

View File

@@ -134,6 +134,11 @@ class WeaviateVector(BaseVector):
def text_exists(self, id: str) -> bool:
collection_name = self._collection_name
schema = self._default_schema(self._collection_name)
# check whether the index already exists
if not self._client.schema.contains(schema):
return False
result = self._client.query.get(collection_name).with_additional(["id"]).with_where({
"path": ["doc_id"],
"operator": "Equal",