fix empty search result (#5979)

Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
pull/5978/head^2
bigsheeper 2021-06-22 16:52:08 +08:00 committed by GitHub
parent 2af1c27811
commit b31bae351d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 0 deletions

View File

@ -729,6 +729,20 @@ func (s *searchCollection) search(searchMsg *msgstream.SearchMsg) error {
}
nilHits[i] = bs
}
// TODO: remove inefficient code in cgo and use SearchResultData directly
// TODO: Currently add a translate layer from hits to SearchResultData
// TODO: hits marshal and unmarshal is likely bottleneck
transformed, err := translateHits(schema, searchMsg.OutputFieldsId, nilHits)
if err != nil {
return err
}
byteBlobs, err := proto.Marshal(transformed)
if err != nil {
return err
}
resultChannelInt := 0
searchResultMsg := &msgstream.SearchResultMsg{
BaseMsg: msgstream.BaseMsg{Ctx: searchMsg.Ctx, HashValues: []uint32{uint32(resultChannelInt)}},
@ -742,6 +756,9 @@ func (s *searchCollection) search(searchMsg *msgstream.SearchMsg) error {
Status: &commonpb.Status{ErrorCode: commonpb.ErrorCode_Success},
ResultChannelID: searchMsg.ResultChannelID,
Hits: nilHits,
SlicedBlob: byteBlobs,
SlicedOffset: 1,
SlicedNumCount: 1,
MetricType: plan.getMetricType(),
SealedSegmentIDsSearched: sealedSegmentSearched,
ChannelIDsSearched: collection.getPChannels(),