Skip to content

Commit

Permalink
fix: Compose empty resultset for result count = 1
Browse files Browse the repository at this point in the history
See also #725

Signed-off-by: Congqi Xia <[email protected]>
  • Loading branch information
congqixia committed Apr 18, 2024
1 parent e697167 commit 5314569
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 99 deletions.
23 changes: 9 additions & 14 deletions client/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,25 +143,20 @@ func (c *GrpcClient) handleSearchResult(schema *entity.Schema, outputFields []st
Scores: results.GetScores()[offset : offset+rc],
}

// parse result set if current nq is not empty
if rc > 0 {
entry.IDs, entry.Err = entity.IDColumns(results.GetIds(), offset, offset+rc)
entry.IDs, entry.Err = entity.IDColumns(schema, results.GetIds(), offset, offset+rc)
if entry.Err != nil {
continue
}
// parse group-by values
if gb != nil {
entry.GroupByValue, entry.Err = entity.FieldDataColumn(gb, offset, offset+rc)
if entry.Err != nil {
offset += rc
continue
}
// parse group-by values
if gb != nil {
entry.GroupByValue, entry.Err = entity.FieldDataColumn(gb, offset, offset+rc)
if entry.Err != nil {
offset += rc
continue
}
}
// entry.GroupByValue, entry.Err = c.parseSearchResult()
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
}
Expand Down
4 changes: 2 additions & 2 deletions client/insert.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (c *GrpcClient) Insert(ctx context.Context, collName string, partitionName
}
MetaCache.setSessionTs(collName, resp.Timestamp)
// 3. parse id column
return entity.IDColumns(resp.GetIDs(), 0, -1)
return entity.IDColumns(coll.Schema, resp.GetIDs(), 0, -1)
}

func (c *GrpcClient) processInsertColumns(colSchema *entity.Schema, columns ...entity.Column) ([]*schemapb.FieldData, int, error) {
Expand Down Expand Up @@ -392,7 +392,7 @@ func (c *GrpcClient) Upsert(ctx context.Context, collName string, partitionName
}
MetaCache.setSessionTs(collName, resp.Timestamp)
// 3. parse id column
return entity.IDColumns(resp.GetIDs(), 0, -1)
return entity.IDColumns(coll.Schema, resp.GetIDs(), 0, -1)
}

// BulkInsert data files(json, numpy, etc.) on MinIO/S3 storage, read and parse them into sealed segments
Expand Down
2 changes: 1 addition & 1 deletion client/row.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (c *GrpcClient) InsertRows(ctx context.Context, collName string, partitionN
}
MetaCache.setSessionTs(collName, resp.Timestamp)
// 3. parse id column
return entity.IDColumns(resp.GetIDs(), 0, -1)
return entity.IDColumns(coll.Schema, resp.GetIDs(), 0, -1)
}

// SearchResultByRows search result for row-based Search
Expand Down
Loading

0 comments on commit 5314569

Please sign in to comment.