From 4f25066aa7d5764835e925eb0ff4afd784a04779 Mon Sep 17 00:00:00 2001 From: xige-16 Date: Thu, 25 Jan 2024 11:03:00 +0800 Subject: [PATCH] fix: Fix requery without limit during HybridSearch (#30220) issue: #29990 /kind bug Signed-off-by: xige-16 Signed-off-by: xige-16 --- internal/proxy/task_hybrid_search.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/internal/proxy/task_hybrid_search.go b/internal/proxy/task_hybrid_search.go index 7090bbdfb8..05f1fd76e2 100644 --- a/internal/proxy/task_hybrid_search.go +++ b/internal/proxy/task_hybrid_search.go @@ -51,6 +51,7 @@ type hybridSearchTask struct { multipleRecallResults *typeutil.ConcurrentSet[*milvuspb.SearchResults] reScorers []reScorer + rankParams *rankParams } func (t *hybridSearchTask) PreExecute(ctx context.Context) error { @@ -250,13 +251,13 @@ func (t *hybridSearchTask) PostExecute(ctx context.Context) error { return err } - rankParams, err := parseRankParams(t.request.GetRankParams()) + t.rankParams, err = parseRankParams(t.request.GetRankParams()) if err != nil { return err } t.result, err = rankSearchResultData(ctx, 1, - rankParams, + t.rankParams, primaryFieldSchema.GetDataType(), t.multipleRecallResults.Collect()) if err != nil { @@ -295,6 +296,12 @@ func (t *hybridSearchTask) Requery() error { NotReturnAllMeta: t.request.GetNotReturnAllMeta(), ConsistencyLevel: t.request.GetConsistencyLevel(), UseDefaultConsistency: t.request.GetUseDefaultConsistency(), + QueryParams: []*commonpb.KeyValuePair{ + { + Key: LimitKey, + Value: strconv.FormatInt(t.rankParams.limit, 10), + }, + }, } // TODO:Xige-16 refine the mvcc functionality of hybrid search