community[patch]: clean warning when delete by ids (#19301)

* Description: rearrange to avoid variable overwrite, which cause
warning always.
* Issue: N/A
* Dependencies: N/A
This commit is contained in:
mackong 2024-03-26 08:23:22 +08:00 committed by GitHub
parent d5415dbd68
commit e65dc4b95b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -933,11 +933,11 @@ class Milvus(VectorStore):
kwargs: Other parameters in Milvus delete api.
"""
if isinstance(ids, list) and len(ids) > 0:
expr = f"{self._primary_field} in {ids}"
if expr is not None:
logger.warning(
"Both ids and expr are provided. " "Ignore expr and delete by ids."
)
expr = f"{self._primary_field} in {ids}"
else:
assert isinstance(
expr, str