Skip to content

Commit

Permalink
Refine some comments related to MilvusClient (#1967)
Browse files Browse the repository at this point in the history
Signed-off-by: zhenshan.cao <[email protected]>
  • Loading branch information
czs007 authored Mar 13, 2024
1 parent 513e54d commit e024793
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions pymilvus/milvus_client/milvus_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def insert(
MilvusException: General Milvus error on insert.
Returns:
Dict: Number of rows that were inserted.
Dict: Number of rows that were inserted and the inserted primary key list.
"""
# If no data provided, we cannot input anything
if isinstance(data, Dict):
Expand All @@ -206,7 +206,7 @@ def insert(
raise TypeError(msg)

if len(data) == 0:
return {"insert_count": 0}
return {"insert_count": 0, "ids": []}

conn = self._get_connection()
# Insert into the collection.
Expand All @@ -226,10 +226,7 @@ def upsert(
partition_name: Optional[str] = "",
**kwargs,
) -> Dict:
"""Insert data into the collection.
If the Milvus Client was initiated without an existing Collection, the first dict passed
in will be used to initiate the collection.
"""Upsert data into the collection.
Args:
data (List[Dict[str, any]]): A list of dicts to pass in. If list not provided, will
Expand All @@ -239,10 +236,10 @@ def upsert(
Raises:
DataNotMatchException: If the data has missing fields an exception will be thrown.
MilvusException: General Milvus error on insert.
MilvusException: General Milvus error on upsert.
Returns:
List[Union[str, int]]: A list of primary keys that were inserted.
Dict: Number of rows that were upserted.
"""
# If no data provided, we cannot input anything
if isinstance(data, Dict):
Expand Down Expand Up @@ -288,7 +285,7 @@ def search(
Args:
data (Union[List[list], list]): The vector/vectors to search.
top_k (int, optional): How many results to return per search. Defaults to 10.
limit (int, optional): How many results to return per search. Defaults to 10.
filter(str, optional): A filter to use for the search. Defaults to None.
output_fields (List[str], optional): List of which field values to return. If None
specified, only primary fields including distances will be returned.
Expand Down Expand Up @@ -344,7 +341,7 @@ def query(
Args:
filter (str): The filter to use for the query.
return_fields (List[str], optional): List of which field values to return. If None
output_fields (List[str], optional): List of which field values to return. If None
specified, all fields excluding vector field will be returned.
partitions (List[str], optional): Which partitions to perform query. Defaults to None.
timeout (float, optional): Timeout to use, overides the client level assigned at init.
Expand Down Expand Up @@ -465,11 +462,7 @@ def delete(
partition_name: Optional[str] = "",
**kwargs,
) -> Dict:
"""Delete entries in the collection by their pk.
Delete all the entries based on the pk. If unsure of pk you can first query the collection
to grab the corresponding data. Then you can delete using the pk_field.
"""Delete entries in the collection by their pk or by filter.
Starting from version 2.3.2, Milvus no longer includes the primary keys in the result
when processing the delete operation on expressions.
Expand Down

0 comments on commit e024793

Please sign in to comment.