Skip to content

Commit

Permalink
Parse result field data when result set entry count is not zero (#624)
Browse files Browse the repository at this point in the history
Since empty field data has no info for fieldName nor field type
it's more meaningful to skip parse field data for empty resultSet

This PR adds ResultCount check before performing fieldData parsing
When resultSet is empty, the entry shall have no error with empty fields
See also #623

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
  • Loading branch information
congqixia authored Nov 10, 2023
1 parent 415f277 commit c7e62d0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions client/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,17 @@ func (c *GrpcClient) Search(ctx context.Context, collName string, partitions []s
ResultCount: rc,
Scores: results.GetScores()[offset : offset+rc],
}
entry.IDs, entry.Err = entity.IDColumns(results.GetIds(), offset, offset+rc)
if entry.Err != nil {
offset += rc
continue
// parse result set if current nq is not empty
if rc > 0 {
entry.IDs, entry.Err = entity.IDColumns(results.GetIds(), offset, offset+rc)
if entry.Err != nil {
offset += rc
continue
}
entry.Fields, entry.Err = c.parseSearchResult(schema, outputFields, fieldDataList, i, offset, offset+rc)
sr = append(sr, entry)
}
entry.Fields, entry.Err = c.parseSearchResult(schema, outputFields, fieldDataList, i, offset, offset+rc)
sr = append(sr, entry)

offset += rc
}
return sr, nil
Expand Down

0 comments on commit c7e62d0

Please sign in to comment.