Skip to content

Commit

Permalink
Check if output_fields is list (milvus-io#579)
Browse files Browse the repository at this point in the history
* Check if output_fields is list

Signed-off-by: kun yu <[email protected]>

* output_fields shoulbe be list

Signed-off-by: kun yu <[email protected]>

* Add output_fields check to search

Signed-off-by: kun yu <[email protected]>
  • Loading branch information
fishpenguin authored Jun 26, 2021
1 parent 43c0f58 commit d578d5b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pymilvus/client/grpc_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,8 @@ def get(self, collection_name, ids, output_fields=None, partition_names=None, ti

@error_handler()
def query(self, collection_name, expr, output_fields=None, partition_names=None, timeout=None):
if output_fields is not None and not isinstance(output_fields, (list, )):
raise ParamError("Invalid query format. 'output_fields' must be a list")
request = Prepare.query_request(collection_name, expr, output_fields, partition_names)
future = self._stub.Query.future(request, wait_for_ready=True, timeout=timeout)
response = future.result()
Expand Down
3 changes: 3 additions & 0 deletions pymilvus/client/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,9 @@ def search_request(cls, collection_name, query_entities, partition_names=None, f
if not isinstance(query_entities, (dict,)):
raise ParamError("Invalid query format. 'query_entities' must be a dict")

if fields is not None and not isinstance(fields, (list, )):
raise ParamError("Invalid query format. 'fields' must be a list")

request = milvus_types.SearchRequest(
collection_name=collection_name,
partition_names=partition_names,
Expand Down

0 comments on commit d578d5b

Please sign in to comment.