Skip to content

Commit

Permalink
fix Client behaviour for output_fields differs from documentation (#398)
Browse files Browse the repository at this point in the history
Signed-off-by: ryjiang <[email protected]>
  • Loading branch information
shanghaikid authored Dec 25, 2024
1 parent 6941413 commit 1750962
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions milvus/grpc/Data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,7 @@ export class Data extends Collection {
'Query',
{
...data,
output_fields: data.output_fields || ['*'],
query_params: parseToKeyValue({ ...limits, ...offset }),
},
data.timeout || this.timeout
Expand Down
14 changes: 14 additions & 0 deletions test/grpc/Data.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,20 @@ describe(`Data.API`, () => {
expect(res4.data.length).toBe(default_values.length);
});

it(`Query withouth output fields should success`, async () => {
const res = await milvusClient.query({
collection_name: COLLECTION_NAME,
expr: 'id > 0',
offset: 0,
limit: 3,
});

expect(res.status.error_code).toEqual(ErrorCode.SUCCESS);
expect(res.data.length).toBe(3);
// fields of data should > 1
expect(Object.keys(res.data[0]).length).toBeGreaterThan(1);
});

it(`Query with count(*)`, async () => {
const queryString = 'count(*)';
const res = await milvusClient.query({
Expand Down

0 comments on commit 1750962

Please sign in to comment.