fix search failed msg (#22071)

Signed-off-by: Wei Liu <wei.liu@zilliz.com>
pull/22076/head
wei liu 2023-02-08 21:02:34 +08:00 committed by GitHub
parent a28b3c28d2
commit 2e4d64eca5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -769,12 +769,10 @@ func (node *QueryNode) Search(ctx context.Context, req *querypb.SearchRequest) (
mu.Lock()
defer mu.Unlock()
if err != nil {
failRet.Status.Reason = err.Error()
failRet.Status.ErrorCode = commonpb.ErrorCode_UnexpectedError
return err
}
if ret.GetStatus().GetErrorCode() != commonpb.ErrorCode_Success {
failRet.Status.Reason = ret.Status.Reason
failRet.Status.ErrorCode = ret.Status.ErrorCode
return fmt.Errorf("%s", ret.Status.Reason)
}
@ -783,6 +781,8 @@ func (node *QueryNode) Search(ctx context.Context, req *querypb.SearchRequest) (
})
}
if err := runningGp.Wait(); err != nil {
// make fail reason comes from first err
failRet.Status.Reason = err.Error()
return failRet, nil
}
@ -1144,12 +1144,10 @@ func (node *QueryNode) Query(ctx context.Context, req *querypb.QueryRequest) (*i
mu.Lock()
defer mu.Unlock()
if err != nil {
failRet.Status.Reason = err.Error()
failRet.Status.ErrorCode = commonpb.ErrorCode_UnexpectedError
return err
}
if ret.GetStatus().GetErrorCode() != commonpb.ErrorCode_Success {
failRet.Status.Reason = ret.Status.Reason
failRet.Status.ErrorCode = ret.Status.ErrorCode
return fmt.Errorf("%s", ret.Status.Reason)
}
@ -1158,6 +1156,7 @@ func (node *QueryNode) Query(ctx context.Context, req *querypb.QueryRequest) (*i
})
}
if err := runningGp.Wait(); err != nil {
failRet.Status.Reason = err.Error()
return failRet, nil
}
ret, err := mergeInternalRetrieveResultsAndFillIfEmpty(ctx, toMergeResults, req.GetReq().GetLimit(), req.GetReq().GetOutputFieldsId(), coll.Schema())