Refine NQ check logic (#19819)

issue: #19682

/kind improvement

Signed-off-by: Yuchen Gao <yuchen.gao@zilliz.com>

Signed-off-by: Yuchen Gao <yuchen.gao@zilliz.com>
pull/19815/head
Ten Thousand Leaves 2022-10-18 13:07:34 +08:00 committed by GitHub
parent 40091392f0
commit a4a6f60279
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -259,12 +259,6 @@ func (t *searchTask) PreExecute(ctx context.Context) error {
sp, ctx := trace.StartSpanFromContextWithOperationName(t.TraceCtx(), "Proxy-Search-PreExecute")
defer sp.Finish()
// Check the nq is valid:
// https://milvus.io/docs/limitations.md
if err := validateLimit(t.request.GetNq()); err != nil {
return fmt.Errorf("%s [%d] is invalid, %w", NQKey, t.request.GetNq(), err)
}
if t.searchShardPolicy == nil {
t.searchShardPolicy = mergeRoundRobinPolicy
}
@ -369,10 +363,16 @@ func (t *searchTask) PreExecute(ctx context.Context) error {
t.SearchRequest.Dsl = t.request.Dsl
t.SearchRequest.PlaceholderGroup = t.request.PlaceholderGroup
// Manually update nq if not set.
nq, err := getNq(t.request)
if err != nil {
return err
}
// Check if nq is valid:
// https://milvus.io/docs/limitations.md
if err := validateLimit(nq); err != nil {
return fmt.Errorf("%s [%d] is invalid, %w", NQKey, nq, err)
}
t.SearchRequest.Nq = nq
log.Ctx(ctx).Debug("search PreExecute done.", zap.Int64("msgID", t.ID()),