Acquire nq from placeholdergroup incase of nq is zero (#17168)

Signed-off-by: zhenshan.cao <zhenshan.cao@zilliz.com>
pull/17179/head
zhenshan.cao 2022-05-24 10:05:58 +08:00 committed by GitHub
parent f93e5a7d42
commit ea8e1623cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -251,6 +251,16 @@ func (t *searchTask) PreExecute(ctx context.Context) error {
t.DbID = 0 // todo
t.SearchRequest.Dsl = t.request.Dsl
t.SearchRequest.PlaceholderGroup = t.request.PlaceholderGroup
if t.request.GetNq() == 0 {
x := &commonpb.PlaceholderGroup{}
err := proto.Unmarshal(t.request.GetPlaceholderGroup(), x)
if err != nil {
return err
}
for _, h := range x.GetPlaceholders() {
t.request.Nq += int64(len(h.Values))
}
}
t.SearchRequest.Nq = t.request.GetNq()
log.Info("search PreExecute done.",
zap.Any("requestID", t.Base.MsgID), zap.Any("requestType", "search"))