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
commit a6cd0f0e73
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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",