From ea629228296a3ec2beab1e6885e138abadeb72f1 Mon Sep 17 00:00:00 2001 From: Gao Date: Tue, 6 Jun 2023 14:28:35 +0800 Subject: [PATCH] Disable search params rewrite while searching with filter (#24625) Signed-off-by: chasingegg --- internal/querynodev2/handlers.go | 2 ++ pkg/common/common.go | 1 + 2 files changed, 3 insertions(+) diff --git a/internal/querynodev2/handlers.go b/internal/querynodev2/handlers.go index 5fddba3161..af18772642 100644 --- a/internal/querynodev2/handlers.go +++ b/internal/querynodev2/handlers.go @@ -271,11 +271,13 @@ func (node *QueryNode) optimizeSearchParams(ctx context.Context, req *querypb.Se }, 0) // use shardNum * segments num in shard to estimate total segment number estSegmentNum := sealedNum * int(channelNum) + withFilter := (plan.GetVectorAnns().GetPredicates() == nil) queryInfo := plan.GetVectorAnns().GetQueryInfo() params := map[string]any{ common.TopKKey: queryInfo.GetTopk(), common.SearchParamKey: queryInfo.GetSearchParams(), common.SegmentNumKey: estSegmentNum, + common.WithFilterKey: withFilter, } err := node.queryHook.Run(params) if err != nil { diff --git a/pkg/common/common.go b/pkg/common/common.go index 6d9374c765..2d21b4d4a3 100644 --- a/pkg/common/common.go +++ b/pkg/common/common.go @@ -86,6 +86,7 @@ const ( TopKKey = "topk" SearchParamKey = "search_param" SegmentNumKey = "segment_num" + WithFilterKey = "with_filter" IndexParamsKey = "params" IndexTypeKey = "index_type"